blob: 2cd9fef6f1c922d69b1f061dac60847270b5f239 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
<h1 id="firstHeading" class="firstHeading">Date and time utilities</h1> <h3 id="Functions"> Functions</h3> <table class="t-dsc-begin"> <tr> <td colspan="2"> <h5 id="Time_manipulation"> Time manipulation </h5> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><time.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/difftime" title="c/chrono/difftime"> <span class="t-lines"><span>difftime</span></span></a></div> </td> <td> computes the difference between times <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/time" title="c/chrono/time"> <span class="t-lines"><span>time</span></span></a></div> </td> <td> returns the current calendar time of the system as time since epoch <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/clock" title="c/chrono/clock"> <span class="t-lines"><span>clock</span></span></a></div> </td> <td> returns raw processor clock time since the program is started <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/timespec_get" title="c/chrono/timespec get"> <span class="t-lines"><span>timespec_get</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> returns the calendar time in seconds and nanoseconds based on a given time base <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/timespec_getres" title="c/chrono/timespec getres"> <span class="t-lines"><span>timespec_getres</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c23">(C23)</span></span></span></div> </td> <td> returns the resolution of calendar time based on a given time base <br> <span class="t-mark">(function)</span> </td>
</tr> <tr> <td colspan="2"> <h5 id="Format_conversions"> Format conversions </h5> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><time.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/asctime" title="c/chrono/asctime"> <span class="t-lines"><span>asctime</span><span>asctime_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-deprecated-c23">(deprecated in C23)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> converts a <code><a href="chrono/tm" title="c/chrono/tm">tm</a></code> object to a textual representation <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/ctime" title="c/chrono/ctime"> <span class="t-lines"><span>ctime</span><span>ctime_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-deprecated-c23">(deprecated in C23)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> converts a <code><a href="chrono/time_t" title="c/chrono/time t">time_t</a></code> object to a textual representation <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/strftime" title="c/chrono/strftime"> <span class="t-lines"><span>strftime</span></span></a></div> </td> <td> converts a <code><a href="chrono/tm" title="c/chrono/tm">tm</a></code> object to custom textual representation <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><wchar.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/wcsftime" title="c/chrono/wcsftime"> <span class="t-lines"><span>wcsftime</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> converts a <code><a href="chrono/tm" title="c/chrono/tm">tm</a></code> object to custom wide string textual representation <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><time.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/gmtime" title="c/chrono/gmtime"> <span class="t-lines"><span>gmtime</span><span>gmtime_r</span><span>gmtime_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c23">(C23)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC) <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/localtime" title="c/chrono/localtime"> <span class="t-lines"><span>localtime</span><span>localtime_r</span><span>localtime_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c23">(C23)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> converts time since epoch to calendar time expressed as local time <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/mktime" title="c/chrono/mktime"> <span class="t-lines"><span>mktime</span></span></a></div> </td> <td> converts calendar time to time since epoch <br> <span class="t-mark">(function)</span> </td>
</tr> </table> <h3 id="Constants"> Constants</h3> <table class="t-dsc-begin"> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><time.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/clocks_per_sec" title="c/chrono/CLOCKS PER SEC"> <span class="t-lines"><span>CLOCKS_PER_SEC</span></span></a></div> </td> <td> number of processor clock ticks per second <br> <span class="t-mark">(macro constant)</span> </td>
</tr> </table> <h3 id="Types"> Types</h3> <table class="t-dsc-begin"> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><time.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/tm" title="c/chrono/tm"> <span class="t-lines"><span>tm</span></span></a></div> </td> <td> calendar time type<br><span class="t-mark">(struct)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/time_t" title="c/chrono/time t"> <span class="t-lines"><span>time_t</span></span></a></div> </td> <td> calendar time since epoch type <br> <span class="t-mark">(typedef)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/clock_t" title="c/chrono/clock t"> <span class="t-lines"><span>clock_t</span></span></a></div> </td> <td> processor time since era type <br> <span class="t-mark">(typedef)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="chrono/timespec" title="c/chrono/timespec"> <span class="t-lines"><span>timespec</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> time in seconds and nanoseconds <br><span class="t-mark">(struct)</span> </td>
</tr> </table> <h3 id="References"> References</h3> <ul>
<li> C17 standard (ISO/IEC 9899:2018): </li>
<ul>
<li> 7.27 Date and time <time.h> (p: 284-291) </li>
<li> 7.29.5.1 The wcsftime function (p: 320-321) </li>
<li> 7.31.14 Date and time <time.h> (p: 333) </li>
</ul>
<li> C11 standard (ISO/IEC 9899:2011): </li>
<ul>
<li> 7.27 Date and time <time.h> (p: 388-397) </li>
<li> 7.29.5.1 The wcsftime function (p: 439-440) </li>
<li> 7.31.14 Date and time <time.h> (p: 456) </li>
</ul>
<li> C99 standard (ISO/IEC 9899:1999): </li>
<ul>
<li> 7.23 Date and time <time.h> (p: 338-347) </li>
<li> 7.24.5.1 The wcsftime function (p: 385-386) </li>
</ul>
<li> C89/C90 standard (ISO/IEC 9899:1990): </li>
<ul><li> 4.12 DATE AND TIME <time.h> </li></ul>
</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/chrono/c" title="cpp/chrono/c">C++ documentation</a></span> for <span class=""><span>C Date and time utilities</span></span> </td>
</tr> </table> <div class="_attribution">
<p class="_attribution-p">
© cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
<a href="https://en.cppreference.com/w/c/chrono" class="_attribution-link">https://en.cppreference.com/w/c/chrono</a>
</p>
</div>
|