chicken-hackers
[Top][All Lists]
Advanced

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

Re: Exposing subsecond precision in current-seconds


From: Lassi Kortela
Subject: Re: Exposing subsecond precision in current-seconds
Date: Wed, 29 Apr 2020 16:53:19 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

The trouble with procedure names of the form `current-*seconds` is that it's not clear whether they return an integer or a float. And in the case of a float, which subdivision of time is represented by the integer part.

E.g. does `current-microseconds` return an integer number of microseconds, or does it return a float whose integer part is full seconds and the fractional part is partial seconds sourced from a roughly microsecond-precision timer? Same concern with `current-milliseconds` and `current-nanoseconds`.

`current-timespec` would be simple enough since timespecs are formally defined in SRFI 174 (and also defined by POSIX "struct timespec" to have nanosecond precision). I appreciate that there's also a need for procedures that return int/float times, but naming those well is not as simple.

See also SRFI 120 (Timer APIs). <https://srfi.schemers.org/srfi-120/srfi-120.html>



reply via email to

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