Commit 4c0b9c0b authored by Benjamin Summerton's avatar Benjamin Summerton

fixed an issue with compilation on Os X

parent 169bf280
......@@ -11,12 +11,7 @@ include system/timers
# Because of issues with portability on Linux, Windows, and OS X, the Apple OS
# needs to use `epochTime()` to get the current time (which is less precise)
# instead of getTicks(). This proc is for internal use only
proc getNanos(): Nanos {.inline.} =
when defined(macosx):
from times import epochTime()
return (epochTime() * 1_000_000_000).Nanos
else:
return getTicks().Nanos
proc getNanos(): Nanos {.inline.}
# Handy conversion functions
......@@ -86,6 +81,22 @@ template bench*(sw: Stopwatch; body: untyped): untyped =
sw.stop()
#====================#
#== Internal Procs ==#
#====================#
when defined(macosx):
# For OS X
from times import epochTime
proc getNanos(): Nanos =
return (epochTime() * 1_000_000_000).Nanos
else:
# For Linux & Windows
proc getNanos(): Nanos =
return getTicks().Nanos
#===============================#
#== Time Conversion Functions ==#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment