User Tools


====== Function GET-UNIVERSAL-TIME, GET-DECODED-TIME ====== ====Syntax==== * **get-universal-time** → //universal-time// * **get-decoded-time** → //second, minute, hour, date, month, year, day, daylight-p, zone// ====Arguments and Values==== * //universal-time// - a //[[CL:Glossary:universal time]]//. * //second//, //minute//, //hour//, //date//, //month//, //year//, //day//, //daylight-p//, //zone// - a //[[CL:Glossary:decoded time]]//. ====Description==== **get-universal-time** returns the current time, represented as a //[[CL:Glossary:universal time]]//. **get-decoded-time** returns the current time, represented as a //[[CL:Glossary:decoded time]]//. ====Examples==== <blockquote> ;;; TODO: should the DATE and DAY variables really be called like ;;; this? They are confusing. ~phoe ;;; At noon on July 4, 1976 in Eastern Daylight Time. (get-decoded-time) <r> 0 ; second 0 ; minute 12 ; hour 4 ; date - day of month 7 ; month 1976 ; year 6 ; day - day of week //[[CL:Glossary:true]]// ; daylight-p 5 ; timezone</r> ;;; At exactly the same instant. (get-universal-time) <r>2414332800</r> ;;; Exactly five minutes later. (get-universal-time) <r>2414333100</r> ;;; The difference is 300 seconds (five minutes) ([[CL:Functions:math-subtract|-]] [[CL:Variables:star|*]] [[CL:Variables:star-star|**]]) <r>300</r> </blockquote> ====Side Effects==== None. ====Affected By==== The time of day (i.e. the passage of time), the system clock's ability to keep accurate time, and the accuracy of the system clock's initial setting. ====Exceptional Situations==== An error of type **[[CL:Types:error]]** might be signaled if the current time cannot be determined. ====See Also==== **[[CL:Functions:decode-universal-time]]**, **[[CL:Functions:encode-universal-time]]**, {\secref\Time} ====Notes==== <blockquote> (get-decoded-time) ≡ ([[CL:Functions:decode-universal-time]] (get-universal-time)) </blockquote> No //[[CL:Glossary:implementation]]// is required to have a way to verify that the time returned is correct. However, if an //[[CL:Glossary:implementation]]// provides a validity check (//e.g.// the failure to have properly initialized the system clock can be reliably detected) and that validity check fails, the //[[CL:Glossary:implementation]]// is strongly encouraged (but not required) to signal an error of type **[[CL:Types:error]]** (rather than, for example, returning a known-to-be-wrong value) that is //[[CL:Glossary:correctable]]// by allowing the user to interactively set the correct time.