Hey, Im trying to add an ETA to one of my programs, what I do is multiply the time taken between to loop iterations and multiply it by whatever remaining iterations.
But for some reasons subtracting two epochTime result (float 64 I assume) always gives out a really small negative float, something like -4.76837158203125e-07. I tried with cputimes and got the same issue.
What is the issue here ?
Example program
proc main() =
let totalProgress = 456
var
lastEpoch = epochTime()
progress = 0
for i in 0..100:
# complex process going on here
let rn = epochTime()
let delta = rn - lastEpoch
let eta = delta * (totalProgress - progress)
echo eta
lastEpoch = epochTime()
progress.inc()
See https://nim-lang.github.io/Nim/monotimes.html
Read about how "monotonic time" in computers work.