Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

dvdhrm
Copy link

@dvdhrm dvdhrm commented Sep 8, 2025

Introduce a new base option called b_time64. This is a boolean option, which defaults to false (in which case it has no effect). If set to true, this will set _TIME_BITS=64 (or equivalent) for all compilations.

This enables a workaround for the Y2038 problem. With _TIME_BITS=64, libc will switch time_t and other relevant time types to 64-bits, if not already 64-bit (i.e., this usually only affects 32-bit platforms). libc will also transparently switch to 64-bit syscalls.

For more background information, there is an LWN article about it (from 10 years ago):

https://lwn.net/Articles/664800/

Handling of this option is similar to _FILE_OFFSET_BITS=64, which meson sets by default. Unfortunately, time_t is much more often used in public APIs, and thus more likely to lead to ABI mismatches when mixing code compiled with and without the option.

NB: This is a draft, as I have not spent too much time figuring out whether this should be a boolean option, or a choice-option (so you can override the value with 32), and whether this needs support for other languages. This is mostly to start a discussion around the feature.

Introduce a new base option called `b_time64`. This is a boolean option,
which defaults to `false` (in which case it has no effect). If set to
true, this will set `_TIME_BITS=64` (or equivalent) for all
compilations.

This enables a workaround for the Y2038 problem. With `_TIME_BITS=64`,
libc will switch `time_t` and other relevant time types to 64-bits, if
not already 64-bit (i.e., this usually only affects 32-bit platforms).
libc will also transparently switch to 64-bit syscalls.

For more background information, there is an LWN article about it (from
10 years ago):

    https://lwn.net/Articles/664800/

Handling of this option is similar to _FILE_OFFSET_BITS=64, which meson
sets by default. Unfortunately, `time_t` is much more often used in
public APIs, and thus more likely to lead to ABI mismatches when mixing
code compiled with and without the option.
@dvdhrm
Copy link
Author

dvdhrm commented Sep 8, 2025

(update: fixed get_option() invocation)

@dvdhrm
Copy link
Author

dvdhrm commented Sep 9, 2025

I would welcome any help in how to properly query the option without having a build target. All my attempts seem to fail so far.

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

Successfully merging this pull request may close these issues.

3 participants