1<html lang="en"> 2<head> 3<title>tzset - 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="up" href="Timefns.html#Timefns" title="Timefns"> 9<link rel="prev" href="_005f_005ftz_005flock.html#g_t_005f_005ftz_005flock" title="__tz_lock"> 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="tzset"></a> 28<p> 29Previous: <a rel="previous" accesskey="p" href="_005f_005ftz_005flock.html#g_t_005f_005ftz_005flock">__tz_lock</a>, 30Up: <a rel="up" accesskey="u" href="Timefns.html#Timefns">Timefns</a> 31<hr> 32</div> 33 34<h3 class="section">8.11 <code>tzset</code>—set timezone characteristics from TZ environment variable</h3> 35 36<p><a name="index-tzset-443"></a><a name="index-g_t_005ftzset_005fr-444"></a><strong>Synopsis</strong> 37<pre class="example"> #include <time.h> 38 void tzset(void); 39 void _tzset_r (struct _reent *); 40 41</pre> 42 <p><strong>Description</strong><br> 43<code>tzset</code> examines the TZ environment variable and sets up the three 44external variables: <code>_timezone</code>, <code>_daylight</code>, and <code>tzname</code>. The 45value of <code>_timezone</code> shall be the offset from the current time zone 46to GMT. The value of <code>_daylight</code> shall be 0 if there is no daylight 47savings time for the current time zone, otherwise it will be non-zero. 48The <code>tzname</code> array has two entries: the first is the name of the 49standard time zone, the second is the name of the daylight-savings time 50zone. 51 52 <p>The TZ environment variable is expected to be in the following POSIX 53format: 54 55 <p>stdoffset1[dst[offset2][,start[/time1],end[/time2]]] 56 57 <p>where: std is the name of the standard time-zone (minimum 3 chars) 58offset1 is the value to add to local time to arrive at Universal time 59it has the form: hh[:mm[:ss]] 60dst is the name of the alternate (daylight-savings) time-zone (min 3 chars) 61offset2 is the value to add to local time to arrive at Universal time 62it has the same format as the std offset 63start is the day that the alternate time-zone starts 64time1 is the optional time that the alternate time-zone starts 65(this is in local time and defaults to 02:00:00 if not specified) 66end is the day that the alternate time-zone ends 67time2 is the time that the alternate time-zone ends 68(it is in local time and defaults to 02:00:00 if not specified) 69 70 <p>Note that there is no white-space padding between fields. Also note that 71if TZ is null, the default is Universal GMT which has no daylight-savings 72time. If TZ is empty, the default EST5EDT is used. 73 74 <p>The function <code>_tzset_r</code> is identical to <code>tzset</code> only it is reentrant 75and is used for applications that use multiple threads. 76 77 <p><br> 78<strong>Returns</strong><br> 79There is no return value. 80 81 <p><br> 82<strong>Portability</strong><br> 83<code>tzset</code> is part of the POSIX standard. 84 85 <p>Supporting OS subroutine required: None 86 87 <p><br> 88 89 </body></html> 90 91