Make many package time procedures use "contextless" calling convention

This commit is contained in:
gingerBill
2021-10-11 20:08:38 +01:00
parent 3a60bee804
commit 0d258e8b55
6 changed files with 16 additions and 19 deletions
+6 -6
View File
@@ -6,16 +6,16 @@ Tick :: struct {
_nsec: i64, // relative amount
}
tick_now :: proc() -> Tick {
tick_now :: proc "contextless" () -> Tick {
return _tick_now()
}
tick_diff :: proc(start, end: Tick) -> Duration {
tick_diff :: proc "contextless" (start, end: Tick) -> Duration {
d := end._nsec - start._nsec
return Duration(d)
}
tick_lap_time :: proc(prev: ^Tick) -> Duration {
tick_lap_time :: proc "contextless" (prev: ^Tick) -> Duration {
d: Duration
t := tick_now()
if prev._nsec != 0 {
@@ -25,18 +25,18 @@ tick_lap_time :: proc(prev: ^Tick) -> Duration {
return d
}
tick_since :: proc(start: Tick) -> Duration {
tick_since :: proc "contextless" (start: Tick) -> Duration {
return tick_diff(start, tick_now())
}
@(deferred_in_out=_tick_duration_end)
SCOPED_TICK_DURATION :: proc(d: ^Duration) -> Tick {
SCOPED_TICK_DURATION :: proc "contextless" (d: ^Duration) -> Tick {
return tick_now()
}
_tick_duration_end :: proc(d: ^Duration, t: Tick) {
_tick_duration_end :: proc "contextless" (d: ^Duration, t: Tick) {
d^ = tick_since(t)
}