Skip to content

Commit

Permalink
Auto merge of #116238 - tamird:gettimeofday, r=thomcc
Browse files Browse the repository at this point in the history
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
58bbca958d917a89124da248735926f86c59a149.

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
58bbca958d917a89124da248735926f86c59a149.

Note that this change was made for aarch64 in
5008a317ce8e508c390ed12bff281f307313376e which predated 10.12 becoming
the minimum supported version. The discussion took place in
rust-lang/rust#91417 and in particular
rust-lang/rust#91417 (comment)
and
rust-lang/rust#91417 (comment)
are relevant.
  • Loading branch information
bors committed Oct 24, 2023
2 parents f2f0450 + 7c1658b commit add4441
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit add4441

Please sign in to comment.