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

LONG_MAX is not the maximum value of 64-bit time_t on 32 bit systems (e.g. ARMv7) #369

Open
xypron opened this issue May 15, 2024 · 2 comments

Comments

@xypron
Copy link

xypron commented May 15, 2024

The library makes the false assumption that time_t is equivalent to long. To avoid the year 2038 problem Linux distributions like Debian and Ubuntu have moved to using 64-bit time_t on 32-bit architectures like ARMv7.

Now we see test failures like:

FAIL tltest-timespec.c:169 -2147483648.999999999 cap- 2147483647.999999999 = 0.999999998 != -2147483648.999999999
FAIL tltest-timespec.c:170 2147483647.999999999 cap- -2147483648.999999999 = 0.999999998 != 2147483647.999999999

To resolve the issue tlog should check the width of time_t and define symbols for the minimum and maximum values of time_t accordingly.

@xypron
Copy link
Author

xypron commented May 15, 2024

xypron added a commit to xypron/tlog that referenced this issue May 15, 2024
The library makes the false assumption that time_t is equivalent to long.
To avoid the year 2038 problem Linux distributions have moved to using
64-bit time_t on 32-bit architectures.

Replace the LONG_MIN and LONG_MAX by new symbols TLOG_TIME_T_MIN,
TLOG_TIME_T_MAX.

Closes: Scribery#369

Signed-off-by: Heinrich Schuchardt <[email protected]>
@justin-stephenson
Copy link
Collaborator

Thank you for the report. Would you mind submitting a PR if you have a fix already ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants