You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
7.0 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Timefns (The Red Hat newlib C Library)</title>
<meta name="description" content="Timefns (The Red Hat newlib C Library)">
<meta name="keywords" content="Timefns (The Red Hat newlib C Library)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Document-Index.html#Document-Index" rel="index" title="Document Index">
<link href="Document-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="asctime.html#asctime" rel="next" title="asctime">
<link href="signal.html#signal" rel="prev" title="signal">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Timefns"></a>
<div class="header">
<p>
Next: <a href="Locale.html#Locale" accesskey="n" rel="next">Locale</a>, Previous: <a href="Signals.html#Signals" accesskey="p" rel="prev">Signals</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Time-Functions-_0028time_002eh_0029"></a>
<h2 class="chapter">8 Time Functions (<samp>time.h</samp>)</h2>
<p>This chapter groups functions used either for reporting on time
(elapsed, current, or compute time) or to perform calculations based
on time.
</p>
<p>The header file <samp>time.h</samp> defines three types. <code>clock_t</code> and
<code>time_t</code> are both used for representations of time particularly
suitable for arithmetic. (In this implementation, quantities of type
<code>clock_t</code> have the highest resolution possible on your machine,
and quantities of type <code>time_t</code> resolve to seconds.) <code>size_t</code>
is also defined if necessary for quantities representing sizes.
</p>
<p><samp>time.h</samp> also defines the structure <code>tm</code> for the traditional
representation of Gregorian calendar time as a series of numbers, with
the following fields:
</p>
<dl compact="compact">
<dt><code>tm_sec</code></dt>
<dd><p>Seconds, between 0 and 60 inclusive (60 allows for leap seconds).
</p>
</dd>
<dt><code>tm_min</code></dt>
<dd><p>Minutes, between 0 and 59 inclusive.
</p>
</dd>
<dt><code>tm_hour</code></dt>
<dd><p>Hours, between 0 and 23 inclusive.
</p>
</dd>
<dt><code>tm_mday</code></dt>
<dd><p>Day of the month, between 1 and 31 inclusive.
</p>
</dd>
<dt><code>tm_mon</code></dt>
<dd><p>Month, between 0 (January) and 11 (December).
</p>
</dd>
<dt><code>tm_year</code></dt>
<dd><p>Year (since 1900), can be negative for earlier years.
</p>
</dd>
<dt><code>tm_wday</code></dt>
<dd><p>Day of week, between 0 (Sunday) and 6 (Saturday).
</p>
</dd>
<dt><code>tm_yday</code></dt>
<dd><p>Number of days elapsed since last January 1, between 0 and 365 inclusive.
</p>
</dd>
<dt><code>tm_isdst</code></dt>
<dd><p>Daylight Savings Time flag: positive means DST in effect, zero means DST
not in effect, negative means no information about DST is available.
Although for mktime(), negative means that it should decide if DST is in
effect or not.
</p></dd>
</dl>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">&bull; <a href="asctime.html#asctime" accesskey="1">asctime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Format time as string
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="clock.html#clock" accesskey="2">clock</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Cumulative processor time
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="ctime.html#ctime" accesskey="3">ctime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Convert time to local and format as string
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="difftime.html#difftime" accesskey="4">difftime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Subtract two times
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="gmtime.html#gmtime" accesskey="5">gmtime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Convert time to UTC (GMT) traditional representation
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="localtime.html#localtime" accesskey="6">localtime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Convert time to local representation
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="mktime.html#mktime" accesskey="7">mktime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Convert time to arithmetic representation
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="strftime.html#strftime" accesskey="8">strftime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Convert date and time to a user-formatted string
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="time.html#time" accesskey="9">time</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get current calendar time (as single number)
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="_005f_005ftz_005flock.html#g_t_005f_005ftz_005flock">__tz_lock</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Lock time zone global variables
</td></tr>
<tr><td align="left" valign="top">&bull; <a href="tzset.html#tzset">tzset</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Set timezone info
</td></tr>
</table>
<hr>
<div class="header">
<p>
Next: <a href="Locale.html#Locale" accesskey="n" rel="next">Locale</a>, Previous: <a href="Signals.html#Signals" accesskey="p" rel="prev">Signals</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>