Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time: use clock_gettime on macos #116238

Merged
merged 3 commits into from
Oct 24, 2023
Merged

time: use clock_gettime on macos #116238

merged 3 commits into from
Oct 24, 2023

Commits on Sep 28, 2023

  1. time: cfg(any(x)) is the same as cfg(x)

    This was left over in c043a0e.
    tamird committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    f264d28 View commit details
    Browse the repository at this point in the history
  2. time: use clock_gettime on macos

    Replace `gettimeofday` with `clock_gettime(CLOCK_REALTIME)` on:
    
    ```
    all(target_os = "macos", not(target_arch = "aarch64")),
        target_os = "ios",
        target_os = "watchos",
        target_os = "tvos"
    ))]
    ```
    
    `gettimeofday` was first used in
    time-rs/time@cc367ed
    which predated the introduction of `clock_gettime` support in macOS
    10.12 Sierra which became the minimum supported version in
    58bbca9.
    tamird committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    b21eb4f View commit details
    Browse the repository at this point in the history
  3. time: use clock_gettime on macos

    Replace `mach_{absolute_time,timebase_info}` with
    `clock_gettime(CLOCK_REALTIME)` on:
    
    ```
    all(target_os = "macos", not(target_arch = "aarch64")),
        target_os = "ios",
        target_os = "watchos",
        target_os = "tvos"
    ))]
    ```
    
    `mach_{absolute_time,timebase_info}` were first used in
    time-rs/time@cc367ed
    which predated the introduction of `clock_gettime` support in macOS
    10.12 Sierra which became the minimum supported version in
    58bbca9.
    
    Note that this change was made for aarch64 in
    5008a31 which predated 10.12 becoming
    the minimum supported version. The discussion took place in
    rust-lang#91417 and in particular
    rust-lang#91417 (comment)
    and
    rust-lang#91417 (comment)
    are relevant.
    tamird committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    bc30010 View commit details
    Browse the repository at this point in the history