povray icon indicating copy to clipboard operation
povray copied to clipboard

Current implementation of `datetime` is not fully portable.

Open c-lipka opened this issue 3 years ago • 0 comments

The current implementation of datetime in all branches (v3.7, v3.8 and v4.0) relies on std::time_t representing time as a genuine POSIX timestamp, i.e. seconds since 1970-01-01 00:00 UTC minus leap seconds (or, more formally, days since 1970-01-01 00:00 UTC × 86,400 + seconds since 00:00 UTC),

Although this is typical, and even required for strict POSIX compliance, it is not guaranteed by the C++ standard, and even some POSIXoid systems do exist that do not conform, e.g. systems using a clock based on TAI rather than UTC, with std::time_t representing time as seconds since 1970-01-01 00:00 UTC including leap seconds: On such systems, our current solution would currently be off by ca. 30 seconds.

The C++ standard does not even guarantee a unit duration of 1 second, nor that a numeric value of 0 corresponds to 1970-01-01 00:00 (UTC, local, or otherwise).

c-lipka avatar Aug 10 '21 23:08 c-lipka