──TIME(─┬────────┬─)───── └─option─┘
TIME returns the local time in the 24-hour clock format hh:mm:ss (hours, minutes, and seconds) by default; for example:
04:41:37
You can use the following options (for which only the capitalized letter is needed) to obtain alternative formats, or to gain access to the elapsed-time clock:
Civil
TIME('L') -> '16:54:22.120000' /* Perhaps */TIME() -> '16:54:22' TIME('H') -> '16' TIME('M') -> '1014' /* 54 + 60*16 */ TIME('S') -> '60862' /* 22 + 60*(54+60*16) */ TIME('N') -> '16:54:22' TIME('C') -> '4:54pm'
The Elapsed-Time Clock
The elapsed-time clock may be used for measuring real time intervals. On the first call to the elapsed-time clock, the clock is started, and both TIME('E') and TIME('R') will return 0.
The clock is saved across internal routine calls, which is to say that an internal routine inherits the time clock its caller started. Any timing the caller is doing is not affected even if an internal routine resets the clock.
Here is an example of the elapsed-time clock:
time('E') -> 0 /* The first call */ /* pause of one second here */ time('E') -> 1.020000 /* or thereabouts */ /* pause of one second here */ time('R') -> 2.030000 /* or thereabouts */ /* pause of one second here */ time('R') -> 1.050000 /* or thereabouts */
┴╓: See the DATE function about consistency of times within a single expression. The elapsed-time clock is synchronized to the other calls to TIME and DATE, so multiple calls to the elapsed-time clock in a single expression always return the same result. For the same reason, the interval between two normal TIME and DATE results may be calculated exactly using the elapsed-time clock.
Implementation maximum: If the number of seconds in the elapsed time exceed nine digits (equivalent to over 31.6 years), an error will result.