Skip to content

Commit 3184ab9

Browse files
authored
Merge pull request #2880 from apple/maxd/cfdate-wasi
Add support for WASI in CFDate.c
2 parents 68b260e + c9fd004 commit 3184ab9

File tree

1 file changed

+3
-3
lines changed
  • CoreFoundation/NumberDate.subproj

1 file changed

+3
-3
lines changed

CoreFoundation/NumberDate.subproj/CFDate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#endif
2828
#endif
2929

30-
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
30+
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI
3131
#include <sys/time.h>
3232
#endif
3333

@@ -115,7 +115,7 @@ CF_EXPORT CFTimeInterval CFGetSystemUptime(void) {
115115
#if TARGET_OS_MAC
116116
uint64_t tsr = mach_absolute_time();
117117
return (CFTimeInterval)((double)tsr * __CF1_TSRRate);
118-
#elif TARGET_OS_LINUX || TARGET_OS_BSD
118+
#elif TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI
119119
struct timespec res;
120120
if (clock_gettime(CLOCK_MONOTONIC, &res) != 0) {
121121
HALT;
@@ -177,7 +177,7 @@ CF_PRIVATE void __CFDateInitialize(void) {
177177
}
178178
__CFTSRRate = (double)freq.QuadPart;
179179
__CF1_TSRRate = 1.0 / __CFTSRRate;
180-
#elif TARGET_OS_LINUX || TARGET_OS_BSD
180+
#elif TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI
181181
struct timespec res;
182182
if (clock_getres(CLOCK_MONOTONIC, &res) != 0) {
183183
HALT;

0 commit comments

Comments
 (0)