Hi,
Jan W. wrote here:
Interestingly I have removed this feature, since I figured out how
to measure elapsed real time on Java, JavaScript and Python platform.
But it could be still usefull, for example for concurrent_and/2.
But if you only have one concurrent_and/2 running in the top-level
thread, and no other threads calling concurrent_and/2, or no other
threads running on your machine, the elapsed real time measurement
can be as good, and is much simpler. You don’t need to code some
extra book keeping. But for SWISH this cannot be assured I guess,
multiple users might want to run concurrent_and/2? Or is this
blocked in the sandbox? I have stashed all my child time computation
stuff for a simpler Prolog system. I am not 100% sure whether SWI-Prolog
has elapsed real time, its a monotonic clock. So the daylight saving
this night, should not affect it, when you had your computer running
and if wall clock were adjusted.
Edit 26.03.2023
I did this changes the last days, and I am now using, the elapsed realtime
is in milliseconds. In nodeJS there is a new API which returns a BigInt!
The browser API is also relatively new:
Java: (System.nanoTime()+500000)/1000000;
JavaScript nodeJS: Number((process.hrtime.bigint()+500000n) / 1000000n);
JavaScript browser: Math.round(performance.now())
Python: int(round(time.monotonic()*1000))
As a monotonic clock it has an arbitrary reference point. I am using the
statistics/2 key “time” for it now. It can be also used for timed wait(),
to redo the wait() in case of a spurious yield. BTW: Since 2018, Firefox 60,
the accuracy of performance.now() is anyway 1 millisecond.