Hi janksenhu,
GetTime() returns the time in
seconds, from no particular moment (In Windows it happens to be the time since Windows was started, wrapping around every 49.71 days). It is meant to be used as delta only, from an earlier moment.
For getting the current time, use:
I just noticed, this supports only second precision (no milliseconds).
To convert this into seconds since 1970, use:
For cases requiring high precision, try setting the GuiApplication's timerResolution property.
If you have:
Code: Select all
define app = (GuiApplication)__thisModule;
app.timerResolution = 60; // 60 hertz
This ends up calling timeSetEvent() on Windows, which I think should increase the precision.
At some point in the past we were using timeBeginPeriod() to change that resolution, but that code is commented out right now.
Please let me know if you run into a limitation or if you find a way to improve on this
Regards,
Jerome