74 lines
1.9 KiB
HTML
74 lines
1.9 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>time(2)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>time(2)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
time, stime - get/set date and time
|
|
|
|
|
|
</PRE>
|
|
<H2>SYNOPSIS</H2><PRE>
|
|
<STRONG>#include</STRONG> <STRONG><sys/types.h></STRONG>
|
|
<STRONG>#include</STRONG> <STRONG><time.h></STRONG>
|
|
|
|
<STRONG>time_t</STRONG> <STRONG>time(time_t</STRONG> <STRONG>*</STRONG><EM>tp</EM><STRONG>)</STRONG>
|
|
<STRONG>int</STRONG> <STRONG>stime(time_t</STRONG> <STRONG>*</STRONG><EM>tp</EM><STRONG>)</STRONG>
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
The system's notion of the current Greenwich time is obtained with the
|
|
<STRONG>time</STRONG> call, and set with the <STRONG>stime</STRONG> call. The time is expressed in seconds
|
|
since midnight (0 hour), January 1, 1970. The time is both returned by
|
|
<STRONG>time</STRONG> and stored in the variable pointed to by <EM>tp</EM> unless <EM>tp</EM> is the null
|
|
pointer.
|
|
|
|
<STRONG>Stime</STRONG> obtains the time to set from the variable pointed to by <EM>tp</EM>.
|
|
|
|
Only the super-user may set the time of day.
|
|
|
|
|
|
</PRE>
|
|
<H2>RETURN</H2><PRE>
|
|
A 0 return value from <STRONG>stime</STRONG> indicates that the call succeeded. <STRONG>Time</STRONG>
|
|
returns the current time on success. A -1 return value indicates an
|
|
error occurred, and in this case an error code is stored into the global
|
|
variable <STRONG>errno</STRONG>.
|
|
|
|
|
|
</PRE>
|
|
<H2>ERRORS</H2><PRE>
|
|
The following error codes may be set in <STRONG>errno</STRONG>:
|
|
|
|
[EFAULT] The <EM>tp</EM> address referenced invalid memory.
|
|
|
|
[EPERM] A user other than the super-user attempted to set the
|
|
time.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<STRONG><A HREF="../man1/date.1.html">date(1)</A></STRONG>, <STRONG><A HREF="../man3/ctime.3.html">ctime(3)</A></STRONG>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|