Dear All,
In compiling my Nim code here using the Javascript backend, I got an error message:
nim js -d:release -o:sir_opt.js sir_opt
sir_opt.nim(55, 12) Error: undeclared identifier: 'cpuTime'
Is cpuTime not defined within the times package (which in the docs, says it is compatible with JS)?
Best wishes
Simon
In some old version of times.nim cpuTime was mapped to epochTime if the platform would not support cpuTime. I think we can do that again; best effort approximations for the JS target are a fact of life.
I disagree. The whole point of a monotonic clock is that it's guaranteed to be monotonic. A non-monotonic clock should not be used as a approximation. If cpuTime has to work in the browser (and I don't think it has to if the times module gets a proper monotonic time type) it should use performance.now. If the user decides that a non-monotonic clock is an acceptable fallback for their use case they can use a shim for performance.now.