blob: c5090df90c7a471fd2e98b3fba797b4973bd9245 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
//+private
//+build js
package time
foreign import "odin_env"
_IS_SUPPORTED :: true
_now :: proc "contextless" () -> Time {
foreign odin_env {
time_now :: proc "contextless" () -> i64 ---
}
return Time{time_now()*1e6}
}
_sleep :: proc "contextless" (d: Duration) {
foreign odin_env {
time_sleep :: proc "contextless" (ms: u32) ---
}
if d > 0 {
time_sleep(u32(d/1e6))
}
}
_tick_now :: proc "contextless" () -> Tick {
foreign odin_env {
tick_now :: proc "contextless" () -> f32 ---
}
return Tick{i64(tick_now()*1e6)}
}
_yield :: proc "contextless" () {
}
|