Page MenuHomeFreeBSD

Use %lld and %llu instead of %ld and %lu in time format
AcceptedPublic

Authored by sebastien.bini_stormshield.eu on Sep 14 2022, 3:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 14, 2:23 AM
Unknown Object (File)
Apr 10 2025, 11:49 AM
Unknown Object (File)
Mar 11 2025, 2:49 PM
Unknown Object (File)
Mar 7 2025, 9:17 PM
Unknown Object (File)
Mar 1 2025, 3:03 PM
Unknown Object (File)
Feb 18 2025, 2:55 AM
Unknown Object (File)
Jan 27 2025, 4:58 PM
Unknown Object (File)
Jan 15 2025, 3:25 PM
Subscribers

Details

Reviewers
imp
Summary

On our ARMv6 products, setting the date to 2038 will make date -e return a negative time.

> date 2038-07-07
> date -e
-2132932729
>

It all comes down to libc's strftime. It uses long which are 32bit long on arm.
This causes an overflow and explains the negative value.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 47383
Build 44270: arc lint + arc unit