Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62749

Re: need to print seconds from the epoch including the millisecond

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <drsalists@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.030
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; '[1]:': 0.09; '[2]:': 0.09; 'cc:addr:python-list': 0.11; 'cc:name:python list': 0.16; 'epoch': 0.16; 'precision.': 0.16; 'strftime': 0.16; 'time.time()': 0.16; 'wrote:': 0.18; 'subject:need': 0.19; 'thu,': 0.19; 'import': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'am,': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'subject:the': 0.34; 'subject:from': 0.34; 'skip:s 30': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'seconds': 0.37; 'to:addr:gmail.com': 0.65; '26,': 0.68; 'date,': 0.68; '10:32': 0.84; '2.7.': 0.84; '2013': 0.98
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:to :cc:content-type; bh=2H5WeNSM+QFQALAxzkJPq/cuSXPOiejeYgPtwqnwwSc=; b=icK1InMgJZnVnKdwdGuptoSLARREs6i3KtFL8HCYnygTN7ZfY6T25FQ8sKDdBdjuQ4 0saK2aDyKboK+fT1iogU4DM23pGiQ/UC8sqVQqbIMlaNbSDwqFLQmEIElN3RpBvA2cvc lWfrBGZ/Lj0jKH85fYst3EgrJEe1jxbmaZweFbtOg5npbbsh7MNuz5bjZrEfKpVwWKtb PxXqhQbUUNhiXtRsI+4oBNtxrn4CnPujrqERSopcUIsRIif7k+jYnEV5h5BwVgY4KK3H gTAxIKxSYL0tTeJX/cg5TtMEC8TbIeDuHtKmjB4049jWmIF84yAzsrjBEty2GHTsAvON FmSg==
MIME-Version 1.0
X-Received by 10.180.205.162 with SMTP id lh2mr30089480wic.57.1388085730155; Thu, 26 Dec 2013 11:22:10 -0800 (PST)
In-Reply-To <e0e7da6b-5cd9-4e6d-bcca-604bd4bd8d73@googlegroups.com>
References <e0e7da6b-5cd9-4e6d-bcca-604bd4bd8d73@googlegroups.com>
Date Thu, 26 Dec 2013 11:22:10 -0800
Subject Re: need to print seconds from the epoch including the millisecond
From Dan Stromberg <drsalists@gmail.com>
To matt.doolittle33@gmail.com
Content-Type text/plain; charset=ISO-8859-1
Cc Python List <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4638.1388085731.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1388085731 news.xs4all.nl 2918 [2001:888:2000:d::a6]:48390
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62749

Show key headers only | View raw


On Thu, Dec 26, 2013 at 10:32 AM,  <matt.doolittle33@gmail.com> wrote:
> i am using 2.7.   I need to print the time in seconds from the epoch with millisecond precision.  i have tried many things but have failed.  heres my latest:
>
>         from time import time, strftime
>         from datetime import datetime, time
>
>         #  write date, time, then seconds from epoch
>         self.logfile.write('%s\t'%(strftime("%Y-%m-%d",)))
>         self.logfile.write('%s\t'%(now.strftime("%H:%M:%S",)))
>         self.logfile.write('%s\t'%(now.time()))

In [1]: import time

In [2]: time.time()
Out[2]: 1388085670.1567955

HTH

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

need to print seconds from the epoch including the millisecond matt.doolittle33@gmail.com - 2013-12-26 10:32 -0800
  Re: need to print seconds from the epoch including the millisecond Dan Stromberg <drsalists@gmail.com> - 2013-12-26 11:22 -0800
    Re: need to print seconds from the epoch including the millisecond matt.doolittle33@gmail.com - 2013-12-26 14:06 -0800
      Re: need to print seconds from the epoch including the millisecond Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-27 09:34 +1100
        Re: need to print seconds from the epoch including the millisecond Grant Edwards <invalid@invalid.invalid> - 2014-01-02 16:23 +0000
          Re: need to print seconds from the epoch including the millisecond Dave Angel <davea@davea.name> - 2014-01-02 21:41 -0500
            Re: need to print seconds from the epoch including the millisecond Grant Edwards <invalid@invalid.invalid> - 2014-01-03 15:33 +0000
              Re: need to print seconds from the epoch including the millisecond Chris Angelico <rosuav@gmail.com> - 2014-01-04 02:41 +1100
      Re: need to print seconds from the epoch including the millisecond Dave Angel <davea@davea.name> - 2013-12-26 17:48 -0500
      Re: need to print seconds from the epoch including the millisecond Terry Reedy <tjreedy@udel.edu> - 2013-12-26 20:03 -0500
      Re: need to print seconds from the epoch including the millisecond Roy Smith <roy@panix.com> - 2013-12-26 20:29 -0500
        Re: need to print seconds from the epoch including the millisecond matt.doolittle33@gmail.com - 2013-12-27 07:43 -0800
      Re: need to print seconds from the epoch including the millisecond Dave Angel <davea@davea.name> - 2013-12-26 23:54 -0500
        Re: need to print seconds from the epoch including the millisecond matt.doolittle33@gmail.com - 2013-12-27 07:42 -0800
        Re: need to print seconds from the epoch including the millisecond matt.doolittle33@gmail.com - 2013-12-27 07:40 -0800
          Re: need to print seconds from the epoch including the millisecond Dave Angel <davea@davea.name> - 2013-12-27 11:20 -0500
          Re: need to print seconds from the epoch including the millisecond Roy Smith <roy@panix.com> - 2013-12-27 11:27 -0500
            Re: need to print seconds from the epoch including the millisecond matt.doolittle33@gmail.com - 2013-12-27 10:09 -0800
              Re: need to print seconds from the epoch including the millisecond Roy Smith <roy@panix.com> - 2013-12-27 13:50 -0500
                Re: need to print seconds from the epoch including the millisecond Roy Smith <roy@panix.com> - 2013-12-27 13:53 -0500
                Re: need to print seconds from the epoch including the millisecond Roy Smith <roy@panix.com> - 2013-12-27 20:15 -0500
              Re: need to print seconds from the epoch including the millisecond Ned Batchelder <ned@nedbatchelder.com> - 2013-12-27 13:49 -0500
                Re: need to print seconds from the epoch including the millisecond matt.doolittle33@gmail.com - 2013-12-30 04:16 -0800
                Re: need to print seconds from the epoch including the millisecond Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-30 14:14 +0000
                Re: need to print seconds from the epoch including the millisecond Cousin Stanley <cousinstanley@gmail.com> - 2013-12-30 10:07 -0700
                Re: need to print seconds from the epoch including the millisecond Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-30 17:35 +0000
                Re: need to print seconds from the epoch including the millisecond Cousin Stanley <cousinstanley@gmail.com> - 2013-12-30 11:17 -0700
                Re: need to print seconds from the epoch including the millisecond Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-12-31 05:57 +1100
          Re: need to print seconds from the epoch including the millisecond Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-12-27 13:14 -0500
          Re: need to print seconds from the epoch including the millisecond Cameron Simpson <cs@zip.com.au> - 2013-12-28 11:25 +1100
            Re: need to print seconds from the epoch including the millisecond matt.doolittle33@gmail.com - 2013-12-29 18:44 -0800
              Re: need to print seconds from the epoch including the millisecond Ned Batchelder <ned@nedbatchelder.com> - 2013-12-30 07:50 -0500
                Re: need to print seconds from the epoch including the millisecond Roy Smith <roy@panix.com> - 2013-12-30 09:22 -0500
              Re: need to print seconds from the epoch including the millisecond Ned Batchelder <ned@nedbatchelder.com> - 2013-12-30 08:01 -0500
                Re: need to print seconds from the epoch including the millisecond matt.doolittle33@gmail.com - 2013-12-30 05:40 -0800
          Re: need to print seconds from the epoch including the millisecond Ned Batchelder <ned@nedbatchelder.com> - 2013-12-27 21:10 -0500
            Re: need to print seconds from the epoch including the millisecond Steven D'Aprano <steve@pearwood.info> - 2013-12-28 03:50 +0000

csiph-web