Time-related procedures Lassi Kortela (09 May 2019 11:36 UTC)
Re: Time-related procedures Lassi Kortela (09 May 2019 15:38 UTC)
Re: Time-related procedures John Cowan (10 May 2019 00:54 UTC)
Re: Time-related procedures Lassi Kortela (10 May 2019 11:48 UTC)
Re: Time-related procedures Lassi Kortela (10 May 2019 11:57 UTC)

Re: Time-related procedures Lassi Kortela 10 May 2019 11:57 UTC

> 4. Set the timestamp of file F to the current time. I would rather have
> a procedure to do precisely this (or a special argument, like giving #t
> or #f instead of a numeric timestamp, to denote the present moment).
> It's trickier to first get the current time from a C function, then
> introduce some delay by going around between Scheme and C, finally
> calling another C function to set the timestamp.
>
> 5. How old is timestamp T? I would have a procedure (age timestamp) that
> returns the difference between the current time and the timestamp as
> accurately and precisely as it can.

These are not as problem-free as I thought. If you want to have a set of
timestamps for several files, it may be important that all of them have
exactly the same numeric value. In that case, calling
(set-file-time-to-current-time filename) for each of them in sequence
would mean that they get subtly different timestamps (difference
measured in microseconds, maybe even milliseconds it they are on a
network file system).

In light of this realization I retract my proposal. It is indeed better
to be able to ask the OS for a file timestamp denoting the present moment.