[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Exposing subsecond precision in current-seconds
From: |
felix . winkelmann |
Subject: |
Re: Exposing subsecond precision in current-seconds |
Date: |
Mon, 27 Apr 2020 21:26:45 +0200 |
> - Change `current-seconds` to use `gettimeofday` in a way that combines both
> seconds and nanoseconds into a double (that should be plenty precision). On
> Windows a replacement could be defined like with PostgreSQL [1]. Or maybe
> don't bother giving Windows users an enhanced experience and return an
> integer here.
That would break a lot of code. "current-seconds" is fine for UNIX timestamps,
which, I guess, is the most frequent usage.
> - 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.
> - Bonus: Make `current-seconds` return two values, the seconds and
> nanoseconds.
> Previously written code should continue to function unchanged. I don't
> really like this idea though, it's a bit too magic and kind of cumbersome
> to use.
Same here as point #1, due to incompatibiltiy (and, no, we should not rely
on surplus values being thrown away).
felix
- Exposing subsecond precision in current-seconds, Vasilij Schneidermann, 2020/04/27
- Re: Exposing subsecond precision in current-seconds, Lassi Kortela, 2020/04/27
- Re: Exposing subsecond precision in current-seconds, Vasilij Schneidermann, 2020/04/27
- Re: Exposing subsecond precision in current-seconds,
felix . winkelmann <=
- Re: Exposing subsecond precision in current-seconds, felix . winkelmann, 2020/04/29
- Re: Exposing subsecond precision in current-seconds, Peter Bex, 2020/04/29
- Re: Exposing subsecond precision in current-seconds, felix . winkelmann, 2020/04/29
- Re: Exposing subsecond precision in current-seconds, Lassi Kortela, 2020/04/29