0.9b (c) 1995 Peter Childs
>>--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 Returns hh:mmxx, the time in Civil format, in which the hours may take the values 1 through 12, and the minutes the values 00 through 59. The minutes are followed immediately by the letters "am" or "pm" to distinguish times in the morning (midnight 12:00am through 11:59am) from noon and afternoon (noon 12:00pm through 11:59pm). The hour will not have a leading zero. The minute field shows the current minute (rather than the nearest minute) for consistency with other TIME results.
Elapsed Returns sssssssss.uu0000, the number of seconds.hundredths since the elapsed time clock was started or reset (see below). The returned number has no leading zeros, but always has four trailing zeros in the decimal portion. It is not affected by the setting of NUMERIC DIGITS.
Hours Returns number of hours since midnight in the format hh (no leading zeros).
Long Returns time in the format hh:mm:ss.uu0000 (where uu is the fraction of seconds in hundredths of a second).
Minutes Returns number of minutes since midnight in the format: mmmm (no leading zeros).
Normal Returns the time in the default format hh:mm:ss, as described above.
Reset Returns sssssssss.uu0000, the number of seconds.hundredths since the elapsed time clock was started or reset (see below) and also resets the elapsed-time clock to zero. The returned number has no leading zeros, but always has four trailing zeros in the decimal portion.
Seconds Returns number of seconds since midnight in the format sssss (no leading zeros). Here are some examples:
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 */
Note: 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.
Inf-HTML End Run - Successful