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)
Sat, Jun 13, 6:34 AM
Unknown Object (File)
Fri, Jun 12, 8:37 PM
Unknown Object (File)
Sat, May 30, 3:14 PM
Unknown Object (File)
Sat, May 30, 10:27 AM
Unknown Object (File)
Wed, May 27, 6:33 PM
Unknown Object (File)
May 22 2026, 2:58 AM
Unknown Object (File)
May 17 2026, 8:33 AM
Unknown Object (File)
Apr 18 2026, 11:26 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