blob: 42d26e91b212d86e57baf4f6afbf04282f247def [file] [log] [blame]
<html lang="en">
<head>
<title>Timefns - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Signals.html#Signals" title="Signals">
<link rel="next" href="Locale.html#Locale" title="Locale">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Timefns"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Locale.html#Locale">Locale</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Signals.html#Signals">Signals</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>
<h2 class="chapter">8 Time Functions (<samp><span class="file">time.h</span></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>The header file <samp><span class="file">time.h</span></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><samp><span class="file">time.h</span></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:
<dl>
<dt><code>tm_sec</code><dd>Seconds, between 0 and 60 inclusive (60 allows for leap seconds).
<br><dt><code>tm_min</code><dd>Minutes, between 0 and 59 inclusive.
<br><dt><code>tm_hour</code><dd>Hours, between 0 and 23 inclusive.
<br><dt><code>tm_mday</code><dd>Day of the month, between 1 and 31 inclusive.
<br><dt><code>tm_mon</code><dd>Month, between 0 (January) and 11 (December).
<br><dt><code>tm_year</code><dd>Year (since 1900), can be negative for earlier years.
<br><dt><code>tm_wday</code><dd>Day of week, between 0 (Sunday) and 6 (Saturday).
<br><dt><code>tm_yday</code><dd>Number of days elapsed since last January 1, between 0 and 365 inclusive.
<br><dt><code>tm_isdst</code><dd>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.
</dl>
<ul class="menu">
<li><a accesskey="1" href="asctime.html#asctime">asctime</a>: Format time as string
<li><a accesskey="2" href="clock.html#clock">clock</a>: Cumulative processor time
<li><a accesskey="3" href="ctime.html#ctime">ctime</a>: Convert time to local and format as string
<li><a accesskey="4" href="difftime.html#difftime">difftime</a>: Subtract two times
<li><a accesskey="5" href="gmtime.html#gmtime">gmtime</a>: Convert time to UTC (GMT) traditional representation
<li><a accesskey="6" href="localtime.html#localtime">localtime</a>: Convert time to local representation
<li><a accesskey="7" href="mktime.html#mktime">mktime</a>: Convert time to arithmetic representation
<li><a accesskey="8" href="strftime.html#strftime">strftime</a>: Convert date and time to a user-formatted string
<li><a accesskey="9" href="time.html#time">time</a>: Get current calendar time (as single number)
<li><a href="_005f_005ftz_005flock.html#g_t_005f_005ftz_005flock">__tz_lock</a>: Lock time zone global variables
<li><a href="tzset.html#tzset">tzset</a>: Set timezone info
</ul>
</body></html>