Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current implementation of datetime is not fully portable. #435

Open
c-lipka opened this issue Aug 10, 2021 · 0 comments
Open

Current implementation of datetime is not fully portable. #435

c-lipka opened this issue Aug 10, 2021 · 0 comments
Labels
bug reported or triaged as proper bug, i.e. not working as designed, and affecting all platforms compatibility reported or triaged as compatibility issue, i.e. affecting only some build or runtime environments

Comments

@c-lipka
Copy link
Member

c-lipka commented Aug 10, 2021

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 c-lipka added bug reported or triaged as proper bug, i.e. not working as designed, and affecting all platforms compatibility reported or triaged as compatibility issue, i.e. affecting only some build or runtime environments labels Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug reported or triaged as proper bug, i.e. not working as designed, and affecting all platforms compatibility reported or triaged as compatibility issue, i.e. affecting only some build or runtime environments
Projects
None yet
Development

No branches or pull requests

1 participant