Skip to content

Use timespec_get on iOS/tvOS/MacCatalyst now that 13.0 is the minimum version - #130246

Merged
BrzVlad merged 2 commits into
mainfrom
copilot/use-timespec-get-ios-tvos
Jul 6, 2026
Merged

Use timespec_get on iOS/tvOS/MacCatalyst now that 13.0 is the minimum version#130246
BrzVlad merged 2 commits into
mainfrom
copilot/use-timespec-get-ios-tvos

Conversation

Copilot AI commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

timespec_get was previously unavailable on iOS/tvOS/MacCatalyst below 13.0, so LogAssert in debug.cpp fell back to gettimeofday for those platforms. Since 13.0 is now the minimum deployment target, that fallback is no longer needed there.

Changes

  • src/coreclr/utilcode/debug.cpp: Remove HOST_IOS, HOST_TVOS, and HOST_MACCATALYST from the gettimeofday fallback condition — timespec_get is now used directly on those platforms. HOST_ANDROID retains the fallback since targeted Android API levels still lack timespec_get support.
// Before
#if defined(HOST_IOS) || defined(HOST_TVOS) || defined(HOST_MACCATALYST) || defined(HOST_ANDROID)
    // timespec_get is only available on iOS 13.0+ and not supported on Android API levels we target

// After
#if defined(HOST_ANDROID)
    // timespec_get is not supported on Android API levels we target

Copilot AI requested review from Copilot and removed request for Copilot July 6, 2026 12:04
Since iOS/tvOS/MacCatalyst now have 13.0 as the minimum version,
timespec_get is available on all these platforms. Only Android still
needs the gettimeofday fallback.

Closes #122440

Co-authored-by: BrzVlad <4720621+BrzVlad@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot July 6, 2026 12:13
Copilot AI changed the title [WIP] Update to use timespec_get on iOS/tvOS/Catalyst Use timespec_get on iOS/tvOS/MacCatalyst now that 13.0 is the minimum version Jul 6, 2026
Copilot AI requested a review from BrzVlad July 6, 2026 12:14
@BrzVlad
BrzVlad marked this pull request as ready for review July 6, 2026 12:34
Copilot AI review requested due to automatic review settings July 6, 2026 12:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR simplifies LogAssert time retrieval on Apple mobile targets by removing the gettimeofday fallback and relying on timespec_get for iOS/tvOS/MacCatalyst, while retaining the fallback for Android.

Changes:

  • Narrow gettimeofday fallback condition in LogAssert to HOST_ANDROID only.
  • Update the associated comment to reflect the remaining Android-only fallback rationale.

Comment thread src/coreclr/utilcode/debug.cpp
@BrzVlad
BrzVlad merged commit 1543a9d into main Jul 6, 2026
108 of 113 checks passed
@BrzVlad
BrzVlad deleted the copilot/use-timespec-get-ios-tvos branch July 6, 2026 16:41
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 7, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
… version (#130246)

`timespec_get` was previously unavailable on iOS/tvOS/MacCatalyst below
13.0, so `LogAssert` in `debug.cpp` fell back to `gettimeofday` for
those platforms. Since 13.0 is now the minimum deployment target, that
fallback is no longer needed there.

## Changes

- **`src/coreclr/utilcode/debug.cpp`**: Remove `HOST_IOS`, `HOST_TVOS`,
and `HOST_MACCATALYST` from the `gettimeofday` fallback condition —
`timespec_get` is now used directly on those platforms. `HOST_ANDROID`
retains the fallback since targeted Android API levels still lack
`timespec_get` support.

```c
// Before
#if defined(HOST_IOS) || defined(HOST_TVOS) || defined(HOST_MACCATALYST) || defined(HOST_ANDROID)
    // timespec_get is only available on iOS 13.0+ and not supported on Android API levels we target

// After
#if defined(HOST_ANDROID)
    // timespec_get is not supported on Android API levels we target
```

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: BrzVlad <4720621+BrzVlad@users.noreply.github.com>
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.

Use timespec_get on iOS/tvOS/Catalyst now that we have 13.0 as min version

4 participants