There is no solution like there would be none with Javascript. When the timeserver of an Application framework is different to the systems time framework it is not measuring really correct
The Xojo docs say:
“Returns the number of microseconds (1,000,000th of a second) that have passed since the user’s device was started.”
So there is a Xojo bug. Either they are using the wrong Mac API, or the docs are wrong… More than likely it’s the former… But I can’t report it as Feedback is crashing on me.
On Mac, Unix, Linux use following command, to get the system running time:
ps -p 1 -o etime
On Mac, you can also use:
sysctl -a | grep kern.boottime
On Windows use:
wmic os get lastbootuptime
The data I posted above is in fact quite correct… it is just a matter of do you want “uptime” (time since last reboot) or as Xojo reports the “awake” time [time the computer has NOT been “asleep”, during the “uptime”)
This is for macOS… I’m not sure, but I think Windows reports “uptime” always
If you are interested not on the boot time but on wake time on Mac use:
sysctl -a | grep kern.waketime
and to retrieve the sleep time
sysctl -a | grep kern.sleeptime