Skip to content

Commit

Permalink
Fixed time overflows that occur when running in a 32-bit Linux target.
Browse files Browse the repository at this point in the history
  • Loading branch information
Barinzaya committed Oct 15, 2024
1 parent 7989d51 commit 142e7d6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/time/time_linux.odin
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ _IS_SUPPORTED :: true

_now :: proc "contextless" () -> Time {
time_spec_now, _ := linux.clock_gettime(.REALTIME)
ns := time_spec_now.time_sec * 1e9 + time_spec_now.time_nsec
return Time{_nsec=i64(ns)}
ns := i64(time_spec_now.time_sec) * 1e9 + i64(time_spec_now.time_nsec)
return Time{_nsec=ns}
}

_sleep :: proc "contextless" (d: Duration) {
Expand All @@ -29,7 +29,7 @@ _sleep :: proc "contextless" (d: Duration) {

_tick_now :: proc "contextless" () -> Tick {
t, _ := linux.clock_gettime(.MONOTONIC_RAW)
return Tick{_nsec = i64(t.time_sec*1e9 + t.time_nsec)}
return Tick{_nsec = i64(t.time_sec)*1e9 + i64(t.time_nsec)}
}

_yield :: proc "contextless" () {
Expand Down

0 comments on commit 142e7d6

Please sign in to comment.