diff --git a/src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Browser.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Browser.Mono.cs index 153783fa1707c0..06298a30fc3acd 100644 --- a/src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Browser.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Threading/TimerQueue.Browser.Mono.cs @@ -65,7 +65,7 @@ private bool SetTimer(uint actualDuration) // shortest time of all TimerQueues private static void ReplaceNextSetTimeout(long shortestDueTimeMs, long currentTimeMs) { - if (shortestDueTimeMs == int.MaxValue) + if (shortestDueTimeMs == long.MaxValue) { return; } @@ -85,7 +85,7 @@ private static long ShortestDueTime() { if (s_scheduledTimers == null) { - return int.MaxValue; + return long.MaxValue; } long shortestDueTimeMs = long.MaxValue; @@ -112,7 +112,7 @@ private static long PumpTimerQueue(long currentTimeMs) List timersToFire = s_scheduledTimersToFire!; List timers; timers = s_scheduledTimers!; - long shortestDueTimeMs = int.MaxValue; + long shortestDueTimeMs = long.MaxValue; for (int i = timers.Count - 1; i >= 0; --i) { TimerQueue timer = timers[i]; diff --git a/src/mono/mono/utils/mono-os-mutex.h b/src/mono/mono/utils/mono-os-mutex.h index 30f914b0893a29..20055973f81cf8 100644 --- a/src/mono/mono/utils/mono-os-mutex.h +++ b/src/mono/mono/utils/mono-os-mutex.h @@ -36,7 +36,7 @@ #if !defined(HOST_WIN32) -#if !defined(CLOCK_MONOTONIC) || defined(HOST_DARWIN) || defined(HOST_WASM) +#if !defined(CLOCK_MONOTONIC) || defined(HOST_DARWIN) || defined(HOST_WASI) #define BROKEN_CLOCK_SOURCE #endif diff --git a/src/mono/mono/utils/mono-time.c b/src/mono/mono/utils/mono-time.c index 68831393bc7c34..2a89bd9d3d0772 100644 --- a/src/mono/mono/utils/mono-time.c +++ b/src/mono/mono/utils/mono-time.c @@ -119,9 +119,10 @@ gint64 mono_msec_boottime (void) { /* clock_gettime () is found by configure on Apple builds, but its only present from ios 10, macos 10.12, tvos 10 and watchos 3 */ -#if !defined (TARGET_WASM) && ((defined(HAVE_CLOCK_MONOTONIC_COARSE) || defined(HAVE_CLOCK_MONOTONIC)) && !(defined(TARGET_IOS) || defined(TARGET_OSX) || defined(TARGET_WATCHOS) || defined(TARGET_TVOS))) +#if ((defined(HAVE_CLOCK_MONOTONIC_COARSE) || defined(HAVE_CLOCK_MONOTONIC)) && !(defined(TARGET_IOS) || defined(TARGET_OSX) || defined(TARGET_WATCHOS) || defined(TARGET_TVOS))) clockid_t clockType = -#if HAVE_CLOCK_MONOTONIC_COARSE + /* emscripten exposes CLOCK_MONOTONIC_COARSE but doesn't implement it */ +#if defined(HAVE_CLOCK_MONOTONIC_COARSE) && !defined(TARGET_WASM) CLOCK_MONOTONIC_COARSE; /* good enough resolution, fastest speed */ #else CLOCK_MONOTONIC;