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


Groups > comp.lang.python > #51817

Re: outputting time in microseconds or milliseconds

Newsgroups comp.lang.python
Date 2013-08-02 08:09 -0700
References <b5df0633-c6fe-4489-adda-5b9f270a904d@googlegroups.com> <51fba781$0$30000$c3e8da3$5496439d@news.astraweb.com>
Message-ID <0a347771-a725-4be4-ac68-6afff7ecd2a5@googlegroups.com> (permalink)
Subject Re: outputting time in microseconds or milliseconds
From matt.doolittle33@gmail.com

Show all headers | View raw


On Friday, August 2, 2013 8:35:13 AM UTC-4, Steven D'Aprano wrote:
> On Fri, 02 Aug 2013 03:54:32 -0700, matt.doolittle33 wrote:
> 
> 
> 
> > Hey everybody,
> 
> > 
> 
> > I am using 2.7 on Ubuntu 12.10.  All I need to do is to print time with
> 
> > the microseconds.  I have been looking at the docs and trying things for
> 
> > about half a day now with no success.  Currently my code looks like
> 
> > this:
> 
> > 
> 
> >         #  write date and time and microseocnds
> 
> >         self.logfile.write('%s\t'%(str(strftime("%Y-%m-%d", ))))
> 
> >         self.logfile.write('%s\t'%(str(strftime("%H:%M:%S", ))))
> 
> >         self.logfile.write('%s\t'%(str(time()))) 
 
> 
> What's this time() function? Where does it come from, and what does it 
> 
> do? By the look of it, it merely returns the string "00:00:00". The 
> 
> time.time() function returns a number of seconds:
> 
> py> "%s" % time.time()
> 
> '1375445812.873546'
> 
> 
right this is the number that i need in the third column. so should i try?: 

> >         self.logfile.write('%s\t'%(str(time.time()))) 

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


Thread

outputting time in microseconds or milliseconds matt.doolittle33@gmail.com - 2013-08-02 03:54 -0700
  Re: outputting time in microseconds or milliseconds Dave Angel <davea@davea.name> - 2013-08-02 12:08 +0000
  Re: outputting time in microseconds or milliseconds Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-08-02 13:59 +0200
    Re: outputting time in microseconds or milliseconds matt.doolittle33@gmail.com - 2013-08-02 06:17 -0700
      Re: outputting time in microseconds or milliseconds Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2013-08-05 08:15 +0200
  Re: outputting time in microseconds or milliseconds Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-02 12:35 +0000
    Re: outputting time in microseconds or milliseconds matt.doolittle33@gmail.com - 2013-08-02 08:09 -0700
  Re: outputting time in microseconds or milliseconds Skip Montanaro <skip@pobox.com> - 2013-08-02 07:37 -0500
    Re: outputting time in microseconds or milliseconds matt.doolittle33@gmail.com - 2013-08-02 07:18 -0700
      Re: outputting time in microseconds or milliseconds Skip Montanaro <skip@pobox.com> - 2013-08-02 10:15 -0500
  Re: outputting time in microseconds or milliseconds Chris Angelico <rosuav@gmail.com> - 2013-08-02 13:50 +0100
  Re: outputting time in microseconds or milliseconds matt.doolittle33@gmail.com - 2013-08-04 04:30 -0700
    Re: outputting time in microseconds or milliseconds Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2013-08-04 13:57 +0200
    Re: outputting time in microseconds or milliseconds Dave Angel <davea@davea.name> - 2013-08-04 13:38 +0000
    Re: outputting time in microseconds or milliseconds Roy Smith <roy@panix.com> - 2013-08-04 10:33 -0400
      Re: outputting time in microseconds or milliseconds matt.doolittle33@gmail.com - 2013-08-07 19:51 -0700
        Re: outputting time in microseconds or milliseconds Skip Montanaro <skip@pobox.com> - 2013-08-08 07:03 -0500
          Re: outputting time in microseconds or milliseconds Roy Smith <roy@panix.com> - 2013-08-08 09:30 -0400

csiph-web