Skip to content

crate: expose cfg for general 64-bit time_t functionality - #5411

Open
dybucc wants to merge 1 commit into
rust-lang:mainfrom
dybucc:time64-global-cfg
Open

crate: expose cfg for general 64-bit time_t functionality#5411
dybucc wants to merge 1 commit into
rust-lang:mainfrom
dybucc:time64-global-cfg

Conversation

@dybucc

@dybucc dybucc commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Description

This patch adds support for a new cfg that should allow easily
toggling support for 64-bit time_t in supported platforms. This
should make testing of this unstable feature flag in downstream crates
easier than having to manually set up the equivalent cfgs for any
one of linux_time_bits64, gnu_time_bits64 or uclibc_time64.

Note support for the equivalent flag in musl has not been included
because we already have set-up automatic detection and toggling of the
corresponding cfg under supported targets 1.

Checklist

  • Relevant tests in libc-test/semver have been updated
  • Commit messages permalink to headers for added or changed API
  • Placeholder or unstable values like *LAST or *MAX have the
    standard doc comment
  • Tested locally (cargo test -p libc-test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot label +stable-nominated

Footnotes

  1. https://github.com/rust-lang/libc/blob/1a8e71f33b1d6ea1e072210e7fc994417bbb2e34/build.rs#L181-L190

Add `cfg` enabling `time64` functionality across all supported targets.
This ensures users have a simple entry point to the crate functionality
gated behind one of `linux_time_bits64`, `uclibc_time64` and
`gnu_time_bits64`.
@rustbot rustbot added S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Aug 14, 2026

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also update CI to use this cfg rather than the current glibc/musl cfg? Since this is what we're most likely to ship, we should make sure it works.

View changes since this review

Comment thread build.rs
Comment on lines 187 to 196
if musl && musl_v1_2 {
set_cfg("musl_v1_2");
if target_ptr_width == "32" {
set_cfg("musl32_time64");
set_cfg("linux_time_bits64");
}
if MUSL_REDIR_TIME64_ARCHES.contains(&target_arch.as_str()) {
set_cfg("musl_redir_time64");
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also set the musl_v1_2 flag, since that's pretty much all it's gating

Comment thread build.rs
Comment on lines +43 to +45
// Global flag to enable one of `linux_time_bits64` or `gnu_time_bits64`.
// The musl flags are enabled by default on supported platforms.
"time64",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this isn't actually needed, this list is only for what gets sent to check-cfg and we won't use time64 directly (at least for now)

@rustbot

rustbot commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

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

Labels

S-waiting-on-author stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants