﻿# TIMES

_Reviewed June 2020_

**xcall TIMES, opcode, elapsed**

TIMES returns high-precision time information.  

**Parameters**

_opcode  _([Num](num.md))  \[in\]

determines operation; see table

_elapsed  _([Num](num.md))  \[out\]

returns the elapsed time in the units and according to the logic described in the following table 

| **Value** | **Units** | **Description** |
|------|------|------|
| 1 | secs | Returns the number of seconds since midnight. This is equivalent to the system variable TIME, except that if the _elapsed_ parameter is a floating point variable, then the returned value may return fractional seconds. |
| 2 | msecs | Returns the number of milliseconds since midnight. As with _opcode_ 1, if _elapsed_ is a floating point variable, a fractional number of milliseconds may be returned. |
| 3 | usecs | Returns the number of microseconds elapsed since the previous _opcode_ 3. Note that this is only practical for timing operations lasting only seconds or perhaps minutes, but not hours or days. The first time this routine is called, the return value will be essentially random garbage. |
| 4 | secs | Returns seconds since "the epoch". Needed to support 2FA / TOTP. |


**See Also**

•	[FNTOTP.BSI in SOSLIB:\[907,10\]](https://bitbucket.org/microsabio/soslib/src/master/907010/fntotp.bsi) for an example of 2FA / TOTP authentication.