diff options
author | GrundleTrundle <gtrundle@sdf.org> | 2015-02-21 14:54:45 -0500 |
---|---|---|
committer | Patrick Kelley <Pat.Kelley@gmail.com> | 2015-02-21 15:18:34 -0500 |
commit | 2abf3b717abfd623c89893e14037c34b73ef99f1 (patch) | |
tree | a871496a11cd5dcc4f9c92ca0b7fbf140d286375 | |
parent | a853d9c3e3a65042a3fa75c021676e22edf13269 (diff) | |
download | Nim-2abf3b717abfd623c89893e14037c34b73ef99f1.tar.gz |
Removed int64 -> int downcast in timers.`-`
On windows when compiling on 32 bit, this can get you a out of range exception for an otherwise valid interval.
-rw-r--r-- | lib/system/timers.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/system/timers.nim b/lib/system/timers.nim index e58ff7adc..e5de791ac 100644 --- a/lib/system/timers.nim +++ b/lib/system/timers.nim @@ -27,9 +27,9 @@ when defined(windows): proc `-`(a, b: TTicks): TNanos = var frequency: int64 QueryPerformanceFrequency(frequency) - var performanceCounterRate = 1000000000.0 / toFloat(frequency.int) + var performanceCounterRate = 1e+9'f64 / float64(frequency) - result = ((a.int64 - b.int64).int.toFloat * performanceCounterRate).TNanos + result = TNanos(float64(a.int64 - b.int64) * performanceCounterRate) elif defined(macosx): type |