Use the glibc 64bit time APIs to mitigate the Y2038 problem on 32bit platforms
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.6k
- Forks
- 1.3k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 69
Description
The GNU libc (glibc) provides alternative 64bit entry points for many of the file and time related functions on 32bit platforms. For C programs these are activated by setting the -D_TIME_BITS=64 and -D_FILE_OFFSET_BITS=64 preprocessor flags. What happens is that all the relevant types (time_t, blksize_t, ...) are defined as 64bit integers and the called symbols are redirected from the standard 32-bit variant like gmtime to a 64bit variant like __gmtime64.
In many ways this is the same as -D_LARGEFILE_SOURCE flag except that this will not add new types and symbols but replace the existing ones. Note that it is possible to use -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 at the same time.
For full 64bit time support on llnux you also need a kernel newer than 5.6, but the 64bit glibc functions should be safe to use anyway and no worse than the 32bit versions.
The 64bit time support is needed when building embedded linux systems on 32bit platforms that are expected to live for 10 to 15 years.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the existing 32-bit Linux platform bindings, using glibc's gmtime and __gmtime64 entry points and the _TIME_BITS=64 and _FILE_OFFSET_BITS=64 flags as the API references. Done means the relevant 64-bit time support is represented for embedded Linux builds on 32-bit platforms and its compatibility with the stated kernel and glibc requirements is established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux, rust
- Domain
- embedded-iot, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100