ansitime.html

来自「Vxworks API操作系统和驱动程序设计API。压缩的HTML文件」· HTML 代码 · 共 662 行 · 第 1/2 页

HTML
662
字号
<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.htm"><i>VxWorks API Reference :  OS 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><a href="./ansiTime.html#asctime">asctime</a>(&nbsp;)</b>  -  convert broken-down time into a string (ANSI)<br><b><a href="./ansiTime.html#asctime_r">asctime_r</a>(&nbsp;)</b>  -  convert broken-down time into a string (POSIX)<br><b><a href="./ansiTime.html#clock">clock</a>(&nbsp;)</b>  -  determine the processor time in use (ANSI)<br><b><a href="./ansiTime.html#ctime">ctime</a>(&nbsp;)</b>  -  convert time in seconds into a string (ANSI)<br><b><a href="./ansiTime.html#ctime_r">ctime_r</a>(&nbsp;)</b>  -  convert time in seconds into a string (POSIX)<br><b><a href="./ansiTime.html#difftime">difftime</a>(&nbsp;)</b>  -  compute the difference between two calendar times (ANSI)<br><b><a href="./ansiTime.html#gmtime">gmtime</a>(&nbsp;)</b>  -  convert calendar time into UTC broken-down time (ANSI)<br><b><a href="./ansiTime.html#gmtime_r">gmtime_r</a>(&nbsp;)</b>  -  convert calendar time into broken-down time (POSIX)<br><b><a href="./ansiTime.html#localtime">localtime</a>(&nbsp;)</b>  -  convert calendar time into broken-down time (ANSI)<br><b><a href="./ansiTime.html#localtime_r">localtime_r</a>(&nbsp;)</b>  -  convert calendar time into broken-down time (POSIX)<br><b><a href="./ansiTime.html#mktime">mktime</a>(&nbsp;)</b>  -  convert broken-down time into calendar time (ANSI)<br><b><a href="./ansiTime.html#strftime">strftime</a>(&nbsp;)</b>  -  convert broken-down time into a formatted string (ANSI)<br><b><a href="./ansiTime.html#time">time</a>(&nbsp;)</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></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.<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 <b>tm_sec</b>;   </td><td align=left> seconds after the minute </td><td align=left> - [0, 59]</tr><tr valign=top><td align=left>int <b>tm_min</b>;   </td><td align=left> minutes after the hour   </td><td align=left> - [0, 59]</tr><tr valign=top><td align=left>int <b>tm_hour</b>;  </td><td align=left> hours after midnight     </td><td align=left> - [0, 23]</tr><tr valign=top><td align=left>int <b>tm_mday</b>;  </td><td align=left> day of the month         </td><td align=left> - [1, 31]</tr><tr valign=top><td align=left>int <b>tm_mon</b>;   </td><td align=left> months since January     </td><td align=left> - [0, 11]</tr><tr valign=top><td align=left>int <b>tm_year</b>;  </td><td align=left> years since 1900</tr><tr valign=top><td align=left>int <b>tm_wday</b>;  </td><td align=left> days since Sunday        </td><td align=left> - [0, 6]</tr><tr valign=top><td align=left>int <b>tm_yday</b>;  </td><td align=left> days since January 1     </td><td align=left> - [0, 365] </tr><tr valign=top><td align=left>int <b>tm_isdst</b>; </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>&nbsp;&nbsp;&nbsp;&nbsp;<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><a href="./ansiStdlib.html#div">div</a>(&nbsp;)</b> and <b><a href="./ansiStdlib.html#div_r">div_r</a>(&nbsp;)</b>, only the routine<b>xxx_r(&nbsp;)</b> is reentrant.  The <b>xxx(&nbsp;)</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>ansiLocale, American National Standard X3.159-1989 <hr><a name="asctime"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>asctime(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>asctime(&nbsp;)</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><a href="./ansiTime.html#asctime_r">asctime_r</a>(&nbsp;)</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.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>asctime_r(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>asctime_r(&nbsp;)</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><a href="./ansiTime.html#asctime">asctime</a>(&nbsp;)</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.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>clock(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>clock(&nbsp;)</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><a href="./ansiTime.html#clock">clock</a>(&nbsp;)</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><a href="./ansiTime.html#clock">clock</a>(&nbsp;)</b> returns -1.<p></blockquote><h4>NOTE</h4><blockquote><p><p>This routine always returns -1 in VxWorks.  VxWorks does not trackper-task time or system idle time.  There is no method of determininghow long a task or the entire system has been doing work.  <b><a href="./tickLib.html#tickGet">tickGet</a>(&nbsp;)</b>can be used to query the number of system ticks since system start.<b><a href="./clockLib.html#clock_gettime">clock_gettime</a>(&nbsp;)</b> can be used to get the current clock time.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>time.h</b><p></blockquote><h4>RETURNS</h4><blockquote><p>-1<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiTime.html#top">ansiTime</a></b>, <b><a href="./tickLib.html#tickGet">tickGet</a>(&nbsp;)</b>, <b><a href="./clockLib.html#clock_gettime">clock_gettime</a>(&nbsp;)</b><hr><a name="ctime"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>ctime(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>ctime(&nbsp;)</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><a href="./ansiTime.html#ctime_r">ctime_r</a>(&nbsp;)</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><a href="./ansiTime.html#asctime">asctime</a>(&nbsp;)</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><a href="./ansiTime.html#asctime">asctime</a>(&nbsp;)</b>, <b><a href="./ansiTime.html#localtime">localtime</a>(&nbsp;)</b><hr><a name="ctime_r"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>ctime_r(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>ctime_r(&nbsp;)</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><a href="./ansiTime.html#ctime">ctime</a>(&nbsp;)</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><a href="./ansiTime.html#asctime">asctime</a>(&nbsp;)</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><a href="./ansiTime.html#asctime">asctime</a>(&nbsp;)</b>, <b><a href="./ansiTime.html#localtime">localtime</a>(&nbsp;)</b><hr><a name="difftime"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>difftime(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>difftime(&nbsp;)</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.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>gmtime(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>gmtime(&nbsp;)</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 */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?