1<html lang="en"> 2<head> 3<title>Timefns - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="prev" href="Signals.html#Signals" title="Signals"> 9<link rel="next" href="Locale.html#Locale" title="Locale"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<meta http-equiv="Content-Style-Type" content="text/css"> 12<style type="text/css"><!-- 13 pre.display { font-family:inherit } 14 pre.format { font-family:inherit } 15 pre.smalldisplay { font-family:inherit; font-size:smaller } 16 pre.smallformat { font-family:inherit; font-size:smaller } 17 pre.smallexample { font-size:smaller } 18 pre.smalllisp { font-size:smaller } 19 span.sc { font-variant:small-caps } 20 span.roman { font-family:serif; font-weight:normal; } 21 span.sansserif { font-family:sans-serif; font-weight:normal; } 22--></style> 23<link rel="stylesheet" type="text/css" href="../cs.css"> 24</head> 25<body> 26<div class="node"> 27<a name="Timefns"></a> 28<p> 29Next: <a rel="next" accesskey="n" href="Locale.html#Locale">Locale</a>, 30Previous: <a rel="previous" accesskey="p" href="Signals.html#Signals">Signals</a>, 31Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> 32<hr> 33</div> 34 35<h2 class="chapter">8 Time Functions (<samp><span class="file">time.h</span></samp>)</h2> 36 37<p>This chapter groups functions used either for reporting on time 38(elapsed, current, or compute time) or to perform calculations based 39on time. 40 41 <p>The header file <samp><span class="file">time.h</span></samp> defines three types. <code>clock_t</code> and 42<code>time_t</code> are both used for representations of time particularly 43suitable for arithmetic. (In this implementation, quantities of type 44<code>clock_t</code> have the highest resolution possible on your machine, 45and quantities of type <code>time_t</code> resolve to seconds.) <code>size_t</code> 46is also defined if necessary for quantities representing sizes. 47 48 <p><samp><span class="file">time.h</span></samp> also defines the structure <code>tm</code> for the traditional 49representation of Gregorian calendar time as a series of numbers, with 50the following fields: 51 52 <dl> 53<dt><code>tm_sec</code><dd>Seconds, between 0 and 60 inclusive (60 allows for leap seconds). 54 55 <br><dt><code>tm_min</code><dd>Minutes, between 0 and 59 inclusive. 56 57 <br><dt><code>tm_hour</code><dd>Hours, between 0 and 23 inclusive. 58 59 <br><dt><code>tm_mday</code><dd>Day of the month, between 1 and 31 inclusive. 60 61 <br><dt><code>tm_mon</code><dd>Month, between 0 (January) and 11 (December). 62 63 <br><dt><code>tm_year</code><dd>Year (since 1900), can be negative for earlier years. 64 65 <br><dt><code>tm_wday</code><dd>Day of week, between 0 (Sunday) and 6 (Saturday). 66 67 <br><dt><code>tm_yday</code><dd>Number of days elapsed since last January 1, between 0 and 365 inclusive. 68 69 <br><dt><code>tm_isdst</code><dd>Daylight Savings Time flag: positive means DST in effect, zero means DST 70not in effect, negative means no information about DST is available. 71Although for mktime(), negative means that it should decide if DST is in 72effect or not. 73</dl> 74 75<ul class="menu"> 76<li><a accesskey="1" href="asctime.html#asctime">asctime</a>: Format time as string 77<li><a accesskey="2" href="clock.html#clock">clock</a>: Cumulative processor time 78<li><a accesskey="3" href="ctime.html#ctime">ctime</a>: Convert time to local and format as string 79<li><a accesskey="4" href="difftime.html#difftime">difftime</a>: Subtract two times 80<li><a accesskey="5" href="gmtime.html#gmtime">gmtime</a>: Convert time to UTC (GMT) traditional representation 81<li><a accesskey="6" href="localtime.html#localtime">localtime</a>: Convert time to local representation 82<li><a accesskey="7" href="mktime.html#mktime">mktime</a>: Convert time to arithmetic representation 83<li><a accesskey="8" href="strftime.html#strftime">strftime</a>: Convert date and time to a user-formatted string 84<li><a accesskey="9" href="time.html#time">time</a>: Get current calendar time (as single number) 85<li><a href="_005f_005ftz_005flock.html#g_t_005f_005ftz_005flock">__tz_lock</a>: Lock time zone global variables 86<li><a href="tzset.html#tzset">tzset</a>: Set timezone info 87</ul> 88 89 </body></html> 90 91