about summary refs log tree commit diff
path: root/library/std/src/sys/pal/unix/time.rs
diff options
context:
space:
mode:
authorMads Marquart <mads@marquart.dk>2024-04-28 18:22:37 +0200
committerMads Marquart <mads@marquart.dk>2024-04-28 18:22:37 +0200
commitd9c0eb8084deb65de69b23a7714b66efbff7eb03 (patch)
treeaac29bbed1315261cad4d77a0025225c1ee658f4 /library/std/src/sys/pal/unix/time.rs
parentcb4940645775f60d74aee2e018d6c516c5aa9ed7 (diff)
downloadrust-d9c0eb8084deb65de69b23a7714b66efbff7eb03.tar.gz
rust-d9c0eb8084deb65de69b23a7714b66efbff7eb03.zip
Use `target_vendor = "apple"` instead of `target_os = "..."`
Diffstat (limited to 'library/std/src/sys/pal/unix/time.rs')
-rw-r--r--library/std/src/sys/pal/unix/time.rs24
1 files changed, 3 insertions, 21 deletions
diff --git a/library/std/src/sys/pal/unix/time.rs b/library/std/src/sys/pal/unix/time.rs
index e69775be8cf..535fe6b27d9 100644
--- a/library/std/src/sys/pal/unix/time.rs
+++ b/library/std/src/sys/pal/unix/time.rs
@@ -86,13 +86,7 @@ impl Timespec {
         // Please note that Apple OS nonetheless accepts the standard unix format when
         // setting file times, which makes this compensation round-trippable and generally
         // transparent.
-        #[cfg(any(
-            target_os = "macos",
-            target_os = "ios",
-            target_os = "tvos",
-            target_os = "watchos",
-            target_os = "visionos",
-        ))]
+        #[cfg(target_vendor = "apple")]
         let (tv_sec, tv_nsec) =
             if (tv_sec <= 0 && tv_sec > i64::MIN) && (tv_nsec < 0 && tv_nsec > -1_000_000_000) {
                 (tv_sec - 1, tv_nsec + 1_000_000_000)
@@ -275,21 +269,9 @@ impl Instant {
         //
         // Instant on macos was historically implemented using mach_absolute_time;
         // we preserve this value domain out of an abundance of caution.
-        #[cfg(any(
-            target_os = "macos",
-            target_os = "ios",
-            target_os = "watchos",
-            target_os = "visionos",
-            target_os = "tvos"
-        ))]
+        #[cfg(target_vendor = "apple")]
         const clock_id: libc::clockid_t = libc::CLOCK_UPTIME_RAW;
-        #[cfg(not(any(
-            target_os = "macos",
-            target_os = "ios",
-            target_os = "watchos",
-            target_os = "visionos",
-            target_os = "tvos"
-        )))]
+        #[cfg(not(target_vendor = "apple"))]
         const clock_id: libc::clockid_t = libc::CLOCK_MONOTONIC;
         Instant { t: Timespec::now(clock_id) }
     }