Time Library Organisation

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Thu Jan 27 11:06:41 EST 2005


Ashley Yakeley <ashley at semantic.org> writes:

>> in milliseconds
>
> This is not fine enough. The current System.Time uses picoseconds,
> for instance.

What others do:

- Unix uses microseconds (gettimeofday) and nanoseconds (clock_gettime).
  On my PC both are actually accurate to microseconds though.

- Java uses milliseconds.

- .NET uses 100ns ticks. I guess this is what Windows NT uses.

- Python uses a Python float (C double) for the number of seconds
  since the Epoch, which gives about 0.2us of resolution until 2038.

On my PC the gettimeofday() call takes almost 2us to complete.

So I would guess nanoseconds are enough. Or maybe the actual unit
should be left implementation-dependent.

Nanoseconds have a nice property that 10^9 fits in 2^30.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


More information about the Libraries mailing list