mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-07 04:14:19 +00:00
Merge pull request #2194 from GrundleTrundle/windows_timer_sub
Fix for timer overflow when using nimprofiler with 32bit Windows target.
This commit is contained in:
@@ -132,7 +132,7 @@ else:
|
||||
proc hook(st: TStackTrace) {.nimcall.} =
|
||||
if interval == 0:
|
||||
hookAux(st, 1)
|
||||
elif getTicks() - t0 > interval:
|
||||
elif int64(t0) == 0 or getTicks() - t0 > interval:
|
||||
hookAux(st, 1)
|
||||
t0 = getTicks()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user