[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exposing subsecond precision in current-seconds

From: Vasilij Schneidermann
Subject: Re: Exposing subsecond precision in current-seconds
Date: Wed, 29 Apr 2020 14:15:27 +0200

On 04/29/20 at 06:38pm, Evan Hanson wrote:
> On 2020-04-27 21:26, address@hidden wrote:
> > > - Add a new procedure in `(chicken time)` or `(chicken time posix)` that 
> > > gives
> > >   you both seconds and nanoseconds, be it as values, list, vector, ...  
> > > Same
> > >   Windows considerations as previously apply.
> > 
> > Probably the best solution, I guess something based on "clock_gettime"
> > is the most precise and portable method, even though it may need librt on
> > some platforms.
> This seems best to me as well.

Thanks for the considerations.  I could imagine going with the following API 
based on SRFI-174, with `current-time` returning timespec records:

    (import (chicken base))
    (import (chicken time posix))
    (define now (current-time))
    (print "Current time: " (timespec->inexact now))
    (print "Current time: " (timespec-seconds now) "." (timespec-nanoseconds 

Implementing the remaining parts of it should be no problem, the most tricky
part of it might be the `timespac-hash` procedure.  That way we'd have another
supported SRFI.


Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]