📄 ansitime.html
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/ansiTime.html - generated by refgen from ansiTime.c --> <title> ansiTime </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual : Libraries</i></a></p></blockquote><h1>ansiTime</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ansiTime</strong> - ANSI <b>time</b> documentation </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./ansiTime.html#asctime">asctime</a></i>( )</b> - convert broken-down time into a string (ANSI)<br><b><i><a href="./ansiTime.html#asctime_r">asctime_r</a></i>( )</b> - convert broken-down time into a string (POSIX)<br><b><i><a href="./ansiTime.html#clock">clock</a></i>( )</b> - determine the processor time in use (ANSI)<br><b><i><a href="./ansiTime.html#ctime">ctime</a></i>( )</b> - convert time in seconds into a string (ANSI)<br><b><i><a href="./ansiTime.html#ctime_r">ctime_r</a></i>( )</b> - convert time in seconds into a string (POSIX)<br><b><i><a href="./ansiTime.html#difftime">difftime</a></i>( )</b> - compute the difference between two calendar times (ANSI)<br><b><i><a href="./ansiTime.html#gmtime">gmtime</a></i>( )</b> - convert calendar time into UTC broken-down time (ANSI)<br><b><i><a href="./ansiTime.html#gmtime_r">gmtime_r</a></i>( )</b> - convert calendar time into broken-down time (POSIX)<br><b><i><a href="./ansiTime.html#localtime">localtime</a></i>( )</b> - convert calendar time into broken-down time (ANSI)<br><b><i><a href="./ansiTime.html#localtime_r">localtime_r</a></i>( )</b> - convert calendar time into broken-down time (POSIX)<br><b><i><a href="./ansiTime.html#mktime">mktime</a></i>( )</b> - convert broken-down time into calendar time (ANSI)<br><b><i><a href="./ansiTime.html#strftime">strftime</a></i>( )</b> - convert broken-down time into a formatted string (ANSI)<br><b><i><a href="./ansiTime.html#time">time</a></i>( )</b> - determine the current calendar time (ANSI)<br><p></blockquote><h4>DESCRIPTION </h4><blockquote><p>The header <b>time.h</b> defines two macros and declares four types and severalfunctions for manipulating time. Many functions deal with a <b>calendar time</b>that represents the current date (according to the Gregorian calendar)and time. Some functions deal with <b>local time</b>, which is the calendartime expressed for some specific time zone, and with Daylight Saving Time,which is a temporary change in the algorithm for determining local time.The local time zone and Daylight Saving Time are implementation-defined.<p></blockQuote><h4>Macros</h4><blockQuote>The macros defined are NULL and:<dl><dt><b>CLOCKS_PER_SEC</b><dd>the number of ticks per second. </dl><p></blockQuote><h4>Types</h4><blockQuote>The types declared are <b>size_t</b> and:<dl><dt><b>clock_t</b>, <b>time_t</b><dd>arithmetic types capable of representing times.<p><dt><b>struct tm</b><dd>holds the components of a calendar time in what is known as "broken-down time." The structure contains at least the following members, in any order.The semantics of the members and their normal ranges are expressed in thecomments.<p><table><tr valign=top><td align=left>int tm_sec; </td><td align=left> seconds after the minute </td><td align=left> - [0, 59]</tr><tr valign=top><td align=left>int tm_min; </td><td align=left> minutes after the hour </td><td align=left> - [0, 59]</tr><tr valign=top><td align=left>int tm_hour; </td><td align=left> hours after midnight </td><td align=left> - [0, 23]</tr><tr valign=top><td align=left>int tm_mday; </td><td align=left> day of the month </td><td align=left> - [1, 31]</tr><tr valign=top><td align=left>int tm_mon; </td><td align=left> months since January </td><td align=left> - [0, 11]</tr><tr valign=top><td align=left>int tm_year; </td><td align=left> years since 1900</tr><tr valign=top><td align=left>int tm_wday; </td><td align=left> days since Sunday </td><td align=left> - [0, 6]</tr><tr valign=top><td align=left>int tm_yday; </td><td align=left> days since January 1 </td><td align=left> - [0, 365] </tr><tr valign=top><td align=left>int tm_isdst; </td><td align=left> Daylight Saving Time flag</tr><tr valign=top><td align=left></tr></tr></table>The value of <b>tm_isdst</b> is positive if Daylight Saving Time is in effect, zeroif Daylight Saving Time is not in effect, and negative if the informationis not available. </dl><p>If the environment variable TIMEZONE is set, the information is retrieved fromthis variable, otherwise from the locale information.TIMEZONE is of the form:<p> <i>name_of_zone</i>:<(unused)>:<i>time_in_minutes_from_UTC</i>:<i>daylight_start</i>:<i>daylight_end</i><p>To calculate local time, the value of <i>time_in_minutes_from_UTC</i> is subtractedfrom UTC; <i>time_in_minutes_from_UTC</i> must be positive.<p>Daylight information is expressed as mmddhh (month-day-hour), forexample:<pre> UTC::0:040102:100102</pre></blockquote><h4>REENTRANCY</h4><blockquote><p>Where there is a pair of routines, such as <b><i><a href="./ansiStdlib.html#div">div</a></i>( )</b> and <b><i><a href="./ansiStdlib.html#div_r">div_r</a></i>( )</b>, only the routine<b><i>xxx_r</i>( )</b> is reentrant. The <b><i>xxx</i>( )</b> routine is not reentrant.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>time.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiTime.html#top">ansiTime</a></b>, ansiLocale, American National Standard X3.159-1989<hr><a name="asctime"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>asctime</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>asctime</i>( )</strong> - convert broken-down time into a string (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>char * asctime ( const struct tm * timeptr /* broken-down time */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine converts the broken-down time pointed to by <i>timeptr</i> into astring of the form:<pre> SUN SEP 16 01:03:52 1973\n\0</pre>This routine is not reentrant. For a reentrant version, see <b><i><a href="./ansiTime.html#asctime_r">asctime_r</a></i>( )</b>.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>time.h</b><p></blockquote><h4>RETURNS</h4><blockquote><p>A pointer to the created string.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiTime.html#top">ansiTime</a></b><hr><a name="asctime_r"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>asctime_r</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>asctime_r</i>( )</strong> - convert broken-down time into a string (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int asctime_r ( const struct tm * timeptr, /* broken-down time */ char * asctimeBuf, /* buffer to contain string */ size_t * buflen /* size of buffer */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine converts the broken-down time pointed to by <i>timeptr</i> into astring of the form:<pre> SUN SEP 16 01:03:52 1973\n\0</pre>The string is copied to <i>asctimeBuf</i>.<p>This routine is the POSIX re-entrant version of <b><i><a href="./ansiTime.html#asctime">asctime</a></i>( )</b>.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>time.h</b><p></blockquote><h4>RETURNS</h4><blockquote><p>The size of the created string.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiTime.html#top">ansiTime</a></b><hr><a name="clock"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>clock</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>clock</i>( )</strong> - determine the processor time in use (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>clock_t clock (void)</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns the implementation's best approximation ofthe processor time used by the program since the beginning of animplementation-defined era related only to the program invocation.To determine the time in seconds, the value returned by <b><i><a href="./ansiTime.html#clock">clock</a></i>( )</b>should be divided by the value of the macro <b>CLOCKS_PER_SEC</b>. If theprocessor time used is not available or its value cannot berepresented, <b><i><a href="./ansiTime.html#clock">clock</a></i>( )</b> returns -1.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>time.h</b><p></blockquote><h4>RETURNS</h4><blockquote><p>ERROR (-1).</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiTime.html#top">ansiTime</a></b><hr><a name="ctime"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>ctime</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>ctime</i>( )</strong> - convert time in seconds into a string (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>char * ctime ( const time_t * timer /* calendar time in seconds */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine converts the calendar time pointed to by <i>timer</i> into localtime in the form of a string. It is equivalent to:<pre> asctime (localtime (timer));</pre>This routine is not reentrant. For a reentrant version, see <b><i><a href="./ansiTime.html#ctime_r">ctime_r</a></i>( )</b>.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>time.h</b><p></blockquote><h4>RETURNS</h4><blockquote><p><p>The pointer returned by <b><i><a href="./ansiTime.html#asctime">asctime</a></i>( )</b> with local broken-down time as theargument.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiTime.html#top">ansiTime</a></b>, <b><i><a href="./ansiTime.html#asctime">asctime</a></i>( )</b>, <b><i><a href="./ansiTime.html#localtime">localtime</a></i>( )</b><hr><a name="ctime_r"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>ctime_r</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>ctime_r</i>( )</strong> - convert time in seconds into a string (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>char * ctime_r ( const time_t * timer, /* calendar time in seconds */ char * asctimeBuf, /* buffer to contain the string */ size_t * buflen /* size of the buffer */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine converts the calendar time pointed to by <i>timer</i> into localtime in the form of a string. It is equivalent to:<pre> asctime (localtime (timer));</pre>This routine is the POSIX re-entrant version of <b><i><a href="./ansiTime.html#ctime">ctime</a></i>( )</b>.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>time.h</b><p></blockquote><h4>RETURNS</h4><blockquote><p><p>The pointer returned by <b><i><a href="./ansiTime.html#asctime">asctime</a></i>( )</b> with local broken-down time as theargument.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiTime.html#top">ansiTime</a></b>, <b><i><a href="./ansiTime.html#asctime">asctime</a></i>( )</b>, <b><i><a href="./ansiTime.html#localtime">localtime</a></i>( )</b><hr><a name="difftime"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>difftime</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>difftime</i>( )</strong> - compute the difference between two calendar times (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>double difftime ( time_t time1, /* later time, in seconds */ time_t time0 /* earlier time, in seconds */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine computes the difference between two calendar times: <i>time1</i> - <i>time0</i>.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>time.h</b><p></blockquote><h4>RETURNS</h4><blockquote><p>The time difference in seconds, expressed as a double.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiTime.html#top">ansiTime</a></b><hr><a name="gmtime"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>gmtime</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>gmtime</i>( )</strong> - convert calendar time into UTC broken-down time (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>struct tm *gmtime ( const time_t * timer /* calendar time in seconds */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine converts the calendar time pointed to by <i>timer</i> intobroken-down time, expressed as Coordinated Universal Time (UTC).<p>This routine is not reentrant. For a reentrant version, see <b><i><a href="./ansiTime.html#gmtime_r">gmtime_r</a></i>( )</b>.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>time.h</b><p></blockquote><h4>RETURNS</h4><blockquote><p><p>A pointer to a broken-down time structure (<b>tm</b>), or a null pointerif UTC is not available.</blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiTime.html#top">ansiTime</a></b><hr><a name="gmtime_r"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -