[Tutor] python time
spir
denis.spir at free.fr
Fri Nov 27 09:27:25 CET 2009
Kent Johnson <kent37 at tds.net> wrote:
> On Wed, Nov 25, 2009 at 11:11 AM, spir <denis.spir at free.fr> wrote:
> > Hello,
> >
> > How does python get the time in microseconds? (In other words, how would I get it if python (like some other languages) would provide time in whole seconds only?)
>
> Use the source...in particular, see floattime() in timemodule.c:
> http://svn.python.org/view/python/branches/release31-maint/Modules/timemodule.c?view=markup
>
> Kent
>
Thanks, Kent.
So, python uses C's gettimeofday() func when available (microsecond), or ftime() (millisecond), else it has only plain second precision using time(). But there is no matching system call AFAIK except for time (via datetime in unix-like systems). So, does someone know of any solution via the system itself? How do C funcs get precise time, anyway?
Denis
________________________________
la vita e estrany
http://spir.wikidot.com/
More information about the Tutor
mailing list