aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaytan Laats <laytanlaats@hotmail.com>2024-08-14 13:27:58 +0200
committerLaytan Laats <laytanlaats@hotmail.com>2024-08-14 13:27:58 +0200
commitf657b4cc0cc7aefd902a27739e68bd9ebcb52558 (patch)
treee52cbcc32bb6fc3ab3ca496957766c505b3a9aba
parentc98c95fcf03d1c5d2e3cdf4df489e455a727fa1c (diff)
time: use `assert_contextless` in wasi implementation
-rw-r--r--core/time/time_wasi.odin19
1 files changed, 3 insertions, 16 deletions
diff --git a/core/time/time_wasi.odin b/core/time/time_wasi.odin
index 452c741d2..88bebe2e3 100644
--- a/core/time/time_wasi.odin
+++ b/core/time/time_wasi.odin
@@ -10,11 +10,7 @@ _IS_SUPPORTED :: true
_now :: proc "contextless" () -> Time {
ts, err := wasi.clock_time_get(wasi.CLOCK_REALTIME, 0)
- when !ODIN_DISABLE_ASSERT {
- if err != nil {
- intrinsics.trap()
- }
- }
+ assert_contextless(err == nil)
return Time{_nsec=i64(ts)}
}
@@ -31,21 +27,12 @@ _sleep :: proc "contextless" (d: Duration) {
&ev,
1,
)
-
- when !ODIN_DISABLE_ASSERT {
- if err != nil || n != 1 || ev.error != nil || ev.type != .CLOCK {
- intrinsics.trap()
- }
- }
+ assert_contextless(err == nil && n == 1 && ev.error == nil && ev.type == .CLOCK)
}
_tick_now :: proc "contextless" () -> Tick {
ts, err := wasi.clock_time_get(wasi.CLOCK_MONOTONIC, 0)
- when !ODIN_DISABLE_ASSERT {
- if err != nil {
- intrinsics.trap()
- }
- }
+ assert_contextless(err == nil)
return Tick{_nsec=i64(ts)}
}