Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'float': 0.07; 'below)': 0.09; 'trailing': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'jan': 0.12; 'random': 0.14; 'digits.': 0.16; 'displayed.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'precision.': 0.16; 'time.time()': 0.16; 'values),': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'subject:need': 0.19; 'cc:addr:python.org': 0.22; 'print': 0.22; '(or': 0.24; 'cc:2**0': 0.24; 'mention': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'returned': 0.30; 'sets': 0.30; 'message- id:@mail.gmail.com': 0.30; 'getting': 0.31; 'decimal': 0.31; 'there.': 0.32; 'subject:the': 0.34; 'subject:from': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'accuracy': 0.36; "he's": 0.36; 'method': 0.36; 'even': 0.60; 'edwards': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=ycLHaZSkP2L9/pxgLkP5K2rb1Sq0qjDVVieitINxCk8=; b=TiEl6h/lLCBap50Z1+E73d8ALyGLTnZAjRjVaWsuv3nyRBrCUqf76l1zZ6DPIl5vyh XtsRyQFHnBDMz40s6DqN8QEhZQXOAnGSXkwM4dPopdqhYxcy4yahPaQCOFOxP9mej2vR Lvyxut1IbGdwGaBkyaWT9QwdKIO4tfSMNrcBY+DhEe2HBjSynkvjBLiqK3GODE03fUwx TReD9+XpVxOspBrzBc2v4m2DDPaSI0xbtTTpSboGnhsYYc0KlBJIzBN7UwoL3gsEXygF Ikb6O9CKFttHLaLccqQW6WWcmPumOJHCTyon7v3FUyTgwQbgBxyca8bR0tfUVqdjOG8q l3VA== MIME-Version: 1.0 X-Received: by 10.68.98.3 with SMTP id ee3mr11091254pbb.31.1388763671772; Fri, 03 Jan 2014 07:41:11 -0800 (PST) In-Reply-To: References: <59aa73ac-e06e-4c0e-83a4-147ac42cad2e@googlegroups.com> <52bcaeed$0$29995$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 4 Jan 2014 02:41:11 +1100 Subject: Re: need to print seconds from the epoch including the millisecond From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1388763675 news.xs4all.nl 2874 [2001:888:2000:d::a6]:33826 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:63065 On Sat, Jan 4, 2014 at 2:33 AM, Grant Edwards wrote: > time.time() returns a Python float. A Python float will have 16 digits > of precision. Perhaps the OS always sets some of those digits to 0 (or > even random values), but they're still there. Perhaps the accuracy or > granularity of the values returned is problematic on some OSes, but > the precision of the value doesn't change: there's no way he's "only > getting 2 decimal places" from time.time() unless (as you mention > below) he's printing them using a method that truncates/rounds. If I print out the value float("1.01"), I get just three digits. When those trailing digits are all zeroes, they won't be displayed. That's exactly what the OP was seeing. ChrisA