diff options
| author | Laytan Laats <laytanlaats@hotmail.com> | 2024-08-17 02:09:52 +0200 |
|---|---|---|
| committer | Laytan Laats <laytanlaats@hotmail.com> | 2024-08-23 18:25:10 +0200 |
| commit | caef37bc18477b1bb945f28be2598dd5fabe2473 (patch) | |
| tree | d0978f987b01f47bc74d6472edfd1de6fc5d9943 /core/time | |
| parent | 574dc5efe6a9397217a810f5918bacc0346f469f (diff) | |
orca: implement core:time and core:log
Diffstat (limited to 'core/time')
| -rw-r--r-- | core/time/time_orca.odin | 29 | ||||
| -rw-r--r-- | core/time/time_other.odin | 1 |
2 files changed, 30 insertions, 0 deletions
diff --git a/core/time/time_orca.odin b/core/time/time_orca.odin new file mode 100644 index 000000000..b2598fd6e --- /dev/null +++ b/core/time/time_orca.odin @@ -0,0 +1,29 @@ +//+private +//+build orca +package time + +import "base:intrinsics" + +import "core:sys/orca" + +_IS_SUPPORTED :: true + +_now :: proc "contextless" () -> Time { + CLK_JAN_1970 :: 2208988800 + secs := orca.clock_time(.DATE) + return Time{i64((secs - CLK_JAN_1970) * 1e9)} +} + +_sleep :: proc "contextless" (d: Duration) { + // NOTE: no way to sleep afaict. + if d > 0 { + orca.log_warning("core:time 'sleep' is unimplemented for orca") + } +} + +_tick_now :: proc "contextless" () -> Tick { + secs := orca.clock_time(.MONOTONIC) + return Tick{i64(secs * 1e9)} +} + +_yield :: proc "contextless" () {} diff --git a/core/time/time_other.odin b/core/time/time_other.odin index dd3d39644..164d23f25 100644 --- a/core/time/time_other.odin +++ b/core/time/time_other.odin @@ -8,6 +8,7 @@ //+build !darwin //+build !wasi //+build !windows +//+build !orca package time _IS_SUPPORTED :: false |