bad times Pierpaolo Bernardi (01 Mar 2024 12:28 UTC)
Re: bad times Lassi Kortela (01 Mar 2024 13:43 UTC)
Re: bad times Lassi Kortela (01 Mar 2024 13:48 UTC)
Re: bad times Pierpaolo Bernardi (01 Mar 2024 19:21 UTC)
Re: bad times Shiro Kawai (01 Mar 2024 19:28 UTC)

Re: bad times Lassi Kortela 01 Mar 2024 13:43 UTC

> Then how can we represent the time "0.5 seconds before the epoch"?

This is indeed a mis-design AFAICT. It may be my fault.

Possible fixes:

- The nanoseconds are unsigned but always go toward the future.

- The nanoseconds are signed.

POSIX says:

The <time.h> header shall declare the timespec structure, which shall
include at least the following members:

time_t  tv_sec    Seconds.
long    tv_nsec   Nanoseconds.

So in POSIX nanoseconds are signed.

I haven't tested what stat() returns when it encounters a file whose
timestamp is earlier than the Unix epoch. (Several types of file system
support those.)