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)
Thu, Dec 25, 1:04 AM
Unknown Object (File)
Wed, Dec 17, 9:46 AM
Unknown Object (File)
Sun, Nov 30, 4:17 AM
Unknown Object (File)
Nov 3 2025, 4:43 PM
Unknown Object (File)
Oct 27 2025, 5:10 PM
Unknown Object (File)
Oct 27 2025, 12:55 AM
Unknown Object (File)
Oct 19 2025, 3:48 AM
Unknown Object (File)
Sep 8 2025, 12:07 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