📄 time.h.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title><time.h></title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_010_010"> </a>NAME</h4><blockquote>time.h - time types</blockquote><h4><a name = "tag_000_010_011"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <time.h></code></pre></blockquote><h4><a name = "tag_000_010_012"> </a>DESCRIPTION</h4><blockquote>The<i><time.h></i>header declares the structure<b>tm</b>,which includes at least the following members:<pre><code>int tm_sec seconds [0,61]int tm_min minutes [0,59]int tm_hour hour [0,23]int tm_mday day of month [1,31]int tm_mon month of year [0,11]int tm_year years since 1900int tm_wday day of week [0,6] (Sunday = 0)int tm_yday day of year [0,365]int tm_isdst daylight savings flag</code></pre><p>The value of<b>tm_isdst</b>is positive if Daylight Saving Time is in effect, 0 if Daylight Saving Time isnot in effect, and negative if the information is not available.<p>This header defines the following symbolic names:<dl compact><dt>NULL<dd>Null pointer constant.<dt>CLK_TCK<dd>Number of clock ticks per second returned by the<i><a href="times.html">times()</a></i>function (<b>LEGACY</b>).<dt>CLOCKS_PER_SEC<dd>A number used to convert the value returned by the<i>clock</i>()function into seconds.</dl><p>The<i><time.h></i>header declares the structure<b>timespec</b>,which has at least the following members:<pre><code>time_t tv_sec secondslong tv_nsec nanoseconds</code></pre><p>This header also declares the <b>itimerspec</b>structure, which has at least the following members:<pre><code>struct timespec it_interval timer periodstruct timespec it_value timer expiration</code></pre><p>The following manifest constants are defined:<dl compact><dt>CLOCK_REALTIME<dd>The identifier of the systemwide realtime clock.<dt>TIMER_ABSTIME<dd>Flag indicating time is absolute with respect to the clock associatedwith a timer.</dl><p>The<b>clock_t</b>,<b>clockid_t</b>,<b>size_t</b>,<b>time_t</b>and<b>timer_t</b>types are defined as described in<i><a href="systypes.h.html"><sys/types.h></a></i>.<p>Although the value of CLOCKS_PER_SEC is required to be 1 millionon all XSI-conformant systems, it may be variable on other systemsand it should not be assumedthat CLOCKS_PER_SEC is a compile-time constant.<p>The value of CLK_TCK is currently the same as the value of<i>sysconf</i>(_SC_CLK_TCK);however, new applications should call<i>sysconf</i>()because the CLK_TCK macro may be withdrawn in a future issue.<p>The<i><time.h></i>header provides a declaration for<i>getdate_err</i>.<p>The following are declared as functions and may also be definedas macros.Function prototypes must be provided for use with an ISO Ccompiler.<pre><code>char *<a href="asctime.html">asctime</a>(const struct tm *);char *<a href="asctime_r.html">asctime_r</a>(const struct tm *, char *);clock_t <a href="clock.html">clock</a>(void);int <a href="clock_getres.html">clock_getres</a>(clockid_t, struct timespec *);int <a href="clock_gettime.html">clock_gettime</a>(clockid_t, struct timespec *);int <a href="clock_settime.html">clock_settime</a>(clockid_t, const struct timespec *);char *<a href="ctime.html">ctime</a>(const time_t *);char *<a href="ctime_r.html">ctime_r</a>(const time_t *, char *);double <a href="difftime.html">difftime</a>(time_t, time_t);struct tm *<a href="getdate.html">getdate</a>(const char *);struct tm *<a href="gmtime.html">gmtime</a>(const time_t *);struct tm *<a href="gmtime_r.html">gmtime_r</a>(const time_t *, struct tm *);struct tm *<a href="localtime.html">localtime</a>(const time_t *);struct tm *<a href="localtime_r.html">localtime_r</a>(const time_t *, struct tm *);time_t <a href="mktime.html">mktime</a>(struct tm *);int <a href="nanosleep.html">nanosleep</a>(const struct timespec *, struct timespec *);size_t <a href="strftime.html">strftime</a>(char *, size_t, const char *, const struct tm *);char *<a href="strptime.html">strptime</a>(const char *, const char *, struct tm *);time_t <a href="time.html">time</a>(time_t *);int <a href="timer_create.html">timer_create</a>(clockid_t, struct sigevent *, timer_t *);int <a href="timer_delete.html">timer_delete</a>(timer_t);int <a href="timer_gettime.html">timer_gettime</a>(timer_t, struct itimerspec *);int <a href="timer_getoverrun.html">timer_getoverrun</a>(timer_t);int <a href="timer_settime.html">timer_settime</a>(timer_t, int, const struct itimerspec *, struct itimerspec *);void <a href="tzset.html">tzset</a>(void);</code></pre><p>The following are declared as variables:<pre><code>extern int daylight;extern long int timezone;extern char *tzname[];</code></pre></blockquote><h4><a name = "tag_000_010_013"> </a>APPLICATION USAGE</h4><blockquote>The range [0,61] for<b>tm_sec</b>allows for the occasional leap second or double leap second.<p><b>tm_year</b>is a signed value, therefore years before 1900 may be represented.<P>The functions<i><a href="clock_getres.html">clock_getres()</a></i>,<i><a href="clock_gettime.html">clock_gettime()</a></i>,<i><a href="clock_settime.html">clock_settime()</a></i>,<i><a href="nanosleep.html">nanosleep()</a></i>,<i><a href="timer_create.html">timer_create()</a></i>,<i><a href="timer_delete.html">timer_delete()</a></i>,<i><a href="timer_getoverrun.html">timer_getoverrun()</a></i>,<i><a href="timer_gettime.html">timer_gettime()</a></i>,and<i><a href="timer_settime.html">timer_settime()</a></i>are part of the <a href="feature.html">Realtime Feature Group</a>.</blockquote><h4><a name = "tag_000_010_014"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_015"> </a>SEE ALSO</h4><blockquote><i><a href="asctime.html">asctime()</a></i>,<i><a href="asctime.html">asctime_r()</a></i>,<i><a href="clock.html">clock()</a></i>,<i><a href="clock_settime.html">clock_settime()</a></i>,<i><a href="ctime.html">ctime()</a></i>,<i><a href="ctime.html">ctime_r()</a></i>,<i><a href="daylight.html">daylight</a></i>,<i><a href="difftime.html">difftime()</a></i>,<i><a href="getdate.html">getdate()</a></i>,<i><a href="gmtime.html">gmtime()</a></i>,<i><a href="gmtime.html">gmtime_r()</a></i>,<i><a href="localtime.html">localtime()</a></i>,<i><a href="localtime.html">localtime_r()</a></i>,<i><a href="mktime.html">mktime()</a></i>,<i><a href="nanosleep.html">nanosleep()</a></i>,<i><a href="strftime.html">strftime()</a></i>,<i><a href="strptime.html">strptime()</a></i>,<i><a href="sysconf.html">sysconf()</a></i>,<i><a href="time.html">time()</a></i>,<i><a href="timer_create.html">timer_create()</a></i>,<i><a href="timer_delete.html">timer_delete()</a></i>,<i><a href="timer_settime.html">timer_settime()</a></i>,<i><a href="timezone.html">timezone</a></i>,<i><a href="tzname.html">tzname()</a></i>,<i><a href="tzset.html">tzset()</a></i>,<i><a href="utime.html">utime()</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -