Updated Oct 2016; see History
xcall MIAMEX, MX_GETTIME, secs {,usecs, utcoffset}
MX_GETTIME (MIAMEX 75) returns the number of seconds, and optionally microseconds, since 00:00:00 January 1, 1970, Coordinated Universal Time (aka the "Epoch").
Parameters
secs (Num)
will receive the number of seconds elapsed since the beginning of the "Epoch". Since there have been many seconds since then, mapping secs as a 4 or 5 byte binary or a floating point is recommended.
usecs (Signed Num)
will be set to -1 if the feature is not supported (e.g. AIX, SCO) or else the number of microseconds to add to SECS. Note that under Windows, the actual resolution is only milliseconds, so USECS will always be a multiple of 1000. The microseconds value is probably not useful in itself but could be useful for measuring the amount of time that a very short operation takes (by calling MX_GETTIME twice, once before and once after). The sample program MIAMEX.BP in EXLIB:[908,30] has been updated to do just that, showing the time to execute a FOR/NEXT loop of 10000 iterations.
utcoffset (Signed Num) [out]
Returns offset in seconds between local time and UTC (Universal Coordinated Time, aka Greenwich Mean Time). Offset will be negative for timezones West of Greenwich. A value of -1 indicates an error. Verions of A-Shell prior to 6.3.1518 will ignore the parameter; so unless you check the version, you should probably set your utcoffset value to -2 before calling the routine so that you can detect if it worked.
Comments
If you are using this function to measure an interval, keep in mind the possibility that the system clock might get updated during that interval, rendering your results meaningless.
The TIME system variable in ASB returns the number of seconds since midnight.
See Also
• | MX_FTFORMATxs to format the time. |
• | TIME system variable |
History
2016 July, A-Shell 6.3.1518: Add utcoffset parameter.