1
0
Fork 0
cl-sites/novaspec.org/cl/f_get-universal-time.html
2025-02-05 18:52:26 +01:00

346 lines
No EOL
7.3 KiB
HTML

<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>get-universal-time, get-decoded-time | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="f_get-universal-time.html"
><LINK REL="next" HREF="f_sleep.html" TYPE="text/html" TITLE="sleep"
><LINK REL="prev" HREF="f_encode-universal-time.html" TYPE="text/html" TITLE="encode-universal-time"
><LINK REL="up" HREF="25_2_Environment_Dictionary.html" TYPE="text/html" TITLE="25.2 Environment Dictionary"
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
><SCRIPT SRC="dpans.js%3F3909942064"
></SCRIPT
><SCRIPT SRC="apropos.js%3F3909942064"
></SCRIPT
></HEAD
><BODY
><DIV
><DIV CLASS="topnav"
><DIV CLASS="breadcrumb"
><SPAN CLASS="breadcrumb-item"
><A HREF="index.html"
>Common Lisp Nova Spec</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="25_Environment.html"
>25. Environment</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="25_2_Environment_Dictionary.html"
>25.2 Environment Dictionary</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="f_get-universal-time.html"
>get-universal-time, get-decoded-time</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="f_encode-universal-time.html" CLASS="prev"
>&#8592;</A
><SPAN ID="apropos-label"
>Apropos </SPAN
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
><A HREF="f_sleep.html" CLASS="next"
>&#8594;</A
></DIV
><DIV ID="apropos-res"
></DIV
></DIV
></DIV
><DIV CLASS="matter"
><DIV CLASS="com"
><DIV CLASS="begincom"
><HR
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="get-universal-time, get-decoded-time"
></SPAN
><B
>get-universal-time, get-decoded-time</B
></TD
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
><I
>Function</I
></TD
></TR
></TABLE
><HR
></DIV
><UL CLASS="subtoc"
></UL
><DL
><DT
><B
>Syntax</B
></DT
><DD
><P CLASS="j"
><B
>get-universal-time</B
> &#10216;<I
>no</I
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>arguments</EM
></A
>&#10217; <SPAN CLASS="arrow"
>&#8594;</SPAN
> <SPAN CLASS="cmssi"
>universal-time</SPAN
></P
><DIV
><B
>get-decoded-time</B
> <SPAN CLASS="cmsy"
>&#10216;</SPAN
><I
>no</I
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>arguments</EM
></A
><SPAN CLASS="cmsy"
>&#10217;</SPAN
> </DIV
><DIV
><SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> <SPAN CLASS="cmssi"
>second,</SPAN
> <SPAN CLASS="cmssi"
>minute,</SPAN
> <SPAN CLASS="cmssi"
>hour,</SPAN
> <SPAN CLASS="cmssi"
>date,</SPAN
> <SPAN CLASS="cmssi"
>month,</SPAN
> <SPAN CLASS="cmssi"
>year,</SPAN
> <SPAN CLASS="cmssi"
>day,</SPAN
> <SPAN CLASS="cmssi"
>daylight-p,</SPAN
> <SPAN CLASS="cmssi"
>zone</SPAN
></DIV
></DD
><DT
><B
>Arguments and Values</B
></DT
><DD
><P CLASS="j"
><VAR CLASS="param"
>universal-time</VAR
> &#8212; a <A HREF="26_1_Glossary.html#universal_time"
><EM CLASS="term"
>universal time</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>second</VAR
>, <VAR CLASS="param"
>minute</VAR
>, <VAR CLASS="param"
>hour</VAR
>, <VAR CLASS="param"
>date</VAR
>, <VAR CLASS="param"
>month</VAR
>, <VAR CLASS="param"
>year</VAR
>, <VAR CLASS="param"
>day</VAR
>, <VAR CLASS="param"
>daylight-p</VAR
>, <VAR CLASS="param"
>zone</VAR
> &#8212; a <A HREF="26_1_Glossary.html#decoded_time"
><EM CLASS="term"
>decoded time</EM
></A
>.</P
></DD
><DT
><B
>Description</B
></DT
><DD
><P CLASS="j"
><A HREF="f_get-universal-time.html" CLASS="funref"
><B
>get-universal-time</B
></A
> returns the current time, represented as a <A HREF="26_1_Glossary.html#universal_time"
><EM CLASS="term"
>universal time</EM
></A
>. </P
><P CLASS="j"
><A HREF="f_get-universal-time.html" CLASS="funref"
><B
>get-decoded-time</B
></A
> returns the current time, represented as a <A HREF="26_1_Glossary.html#decoded_time"
><EM CLASS="term"
>decoded time</EM
></A
>.</P
></DD
><DT
><B
>Examples</B
></DT
><DD
><PRE CLASS="screen"
>;; At noon on July 4, 1976 in Eastern Daylight Time.
(get-decoded-time) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 0, 0, 12, 4, 7, 1976, 6, <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
>, 5
;; At exactly the same instant.
(get-universal-time) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 2414332800
;; Exactly five minutes later.
(get-universal-time) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 2414333100
;; The difference is 300 seconds (five minutes)
(- * **) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 300</PRE
></DD
><DT
><B
>Affected By</B
></DT
><DD
><P CLASS="j"
>The time of day (<I CLASS="i"
><I
>i.e.</I
></I
>, the passage of time), the system clock&#8217;s ability to keep accurate time, and the accuracy of the system clock&#8217;s initial setting.</P
></DD
><DT
><B
>Exceptional Situations</B
></DT
><DD
><P CLASS="j"
>An error of <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> <A HREF="t_error.html" CLASS="typeref"
><B
>error</B
></A
> might be signaled if the current time cannot be determined.</P
></DD
><DT
><B
>See Also</B
></DT
><DD
><P CLASS="j"
><A HREF="f_decode-universal-time.html" CLASS="funref"
><B
>decode-universal-time</B
></A
>, <A HREF="f_encode-universal-time.html" CLASS="funref"
><B
>encode-universal-time</B
></A
>, <A HREF="25_1_The_External_Environment.html#sec_25_1_4" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>25.1.4</SPAN
> <SPAN CLASS="cmr"
>(Time)</SPAN
></A
></P
></DD
><DT
><B
>Notes</B
></DT
><DD
><PRE CLASS="screen"
>(get-decoded-time) <SPAN CLASS="cmsy"
><SPAN STYLE="font-size:16px;vertical-align:-2px"
>&#8801;</SPAN
></SPAN
> (decode-universal-time (get-universal-time))</PRE
><P CLASS="j"
>No <A HREF="26_1_Glossary.html#implementation"
><EM CLASS="term"
>implementation</EM
></A
> is required to have a way to verify that the time returned is correct. However, if an <A HREF="26_1_Glossary.html#implementation"
><EM CLASS="term"
>implementation</EM
></A
> provides a validity check (<I CLASS="i"
><I
>e.g.</I
></I
>, the failure to have properly initialized the system clock can be reliably detected) and that validity check fails, the <A HREF="26_1_Glossary.html#implementation"
><EM CLASS="term"
>implementation</EM
></A
> is strongly encouraged (but not required) to signal an error of <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> <A HREF="t_error.html" CLASS="typeref"
><B
>error</B
></A
> (rather than, for example, returning a known-to-be-wrong value) that is <A HREF="26_1_Glossary.html#correctable"
><EM CLASS="term"
>correctable</EM
></A
> by allowing the user to interactively set the correct time.</P
></DD
></DL
></DIV
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="f_encode-universal-time.html" CLASS="prev"
>&#8592;</A
><A HREF="f_sleep.html" CLASS="next"
>&#8594;</A
></DIV
><DIV CLASS="trail"
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
></DIV
></DIV
><SCRIPT
>domReady();</SCRIPT
></BODY
></HTML
>