[local-time-devel] microseconds/nanoseconds in timestamps

Denys Rtveliashvili rtvd at mail.ru
Sat Sep 22 17:15:43 UTC 2007


Hi,

I am looking for a way to find out time with a high precision, ideally 
up to microseconds. As far as I understand, the standard Common Lisp 
library does not allow to do that. However local-time library's API does 
provide that kind of functionality in its API.
So I tried my luck. Unfortunately, it looks like (local-time-msec (now)) 
always returns zero. The (now) does not populate the msec field so there 
is no way to get the time stamp with the required resolution.

As for formatting the time, I see that there is a library cl-i10n 
(http://common-lisp.net/project/cl-l10n/) which provides among other 
things time formatting functionality. Unfortunately, even though they 
declare support for printing out nanoseconds component of time stamp, in 
practice it is always shown as 000000000.

I am wondering if you find these ideas useful:
1. use implementation-specific features to get high-precision time when 
possible
2. change the library so that nanoseconds are used instead of 
microseconds (this will give more space for maneuvering in the future 
and will not be difficult at all)

Regards,
Denys Rtveliashvili



More information about the local-time-devel mailing list