| <html lang="en"> |
| <head> |
| <title>localtime - 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="up" href="Timefns.html#Timefns" title="Timefns"> |
| <link rel="prev" href="gmtime.html#gmtime" title="gmtime"> |
| <link rel="next" href="mktime.html#mktime" title="mktime"> |
| <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="localtime"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="mktime.html#mktime">mktime</a>, |
| Previous: <a rel="previous" accesskey="p" href="gmtime.html#gmtime">gmtime</a>, |
| Up: <a rel="up" accesskey="u" href="Timefns.html#Timefns">Timefns</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">8.6 <code>localtime</code>—convert time to local representation</h3> |
| |
| <p><a name="index-localtime-436"></a><a name="index-localtime_005fr-437"></a><strong>Synopsis</strong> |
| <pre class="example"> #include <time.h> |
| struct tm *localtime(time_t *<var>clock</var>); |
| struct tm *localtime_r(time_t *<var>clock</var>, struct tm *<var>res</var>); |
| |
| </pre> |
| <p><strong>Description</strong><br> |
| <code>localtime</code> converts the time at <var>clock</var> into local time, then |
| converts its representation from the arithmetic representation to the |
| traditional representation defined by <code>struct tm</code>. |
| |
| <p><code>localtime</code> constructs the traditional time representation in static |
| storage; each call to <code>gmtime</code> or <code>localtime</code> will overwrite the |
| information generated by previous calls to either function. |
| |
| <p><code>mktime</code> is the inverse of <code>localtime</code>. |
| |
| <p><br> |
| <strong>Returns</strong><br> |
| A pointer to the traditional time representation (<code>struct tm</code>). |
| |
| <p><br> |
| <strong>Portability</strong><br> |
| ANSI C requires <code>localtime</code>. |
| |
| <p><code>localtime</code> requires no supporting OS subroutines. |
| |
| <p><br> |
| |
| </body></html> |
| |