1 .\" $NetBSD: tzset.3,v 1.32 2015/04/05 08:36:38 pgoyette Exp $
10 .Nd initialize time conversion information
16 .Fn tzalloc "const char *zone"
18 .Fn tzfree "timezone_t restrict tz"
20 .Fn tzgetname "timezone_t restrict tz" "int isdst"
26 function takes as an argument a timezone name and returns a
28 object suitable to be used in the
37 is not a valid time zone description, or if the object cannot be allocated,
46 pointer may be passed to
48 instead of a timezone name, to refer to the current system timezone.
49 An empty timezone string indicates Coordinated Universal Time
52 Note that instead of setting the environment variable
54 and globally changing the behavior of the calling program, one can use
55 multiple timezones at the same time by using separate
61 variants of the functions.
66 which was previously allocated by
75 returns the name for the given
81 the call is equivalent to
87 the call is equivalent to
92 .Dv tzalloc(getenv("TZ")) ,
93 except it saves any resulting time zone object into internal
94 storage that is accessed by
99 The anonymous shared time zone object is freed by the next call to
101 If the implied call to
110 the best available approximation to local wall clock time, as
119 appears in the environment but its value is the empty string,
120 Universal Time (UT) is used, with the abbreviation
122 and without leap second correction; please see
126 is nonnull and nonempty:
129 if the value begins with a colon, it is used as a pathname of a file
130 from which to read the time conversion information;
132 if the value does not begin with a colon, it is first used as the
133 pathname of a file from which to read the time conversion information,
134 and, if that file cannot be read, is used directly as a specification
135 of the time conversion information.
140 is used as a pathname, if it begins with a slash, it is used as an
141 absolute pathname; otherwise, it is used as a pathname relative to
142 .Pa /usr/share/zoneinfo .
143 The file must be in the format specified in
148 is used directly as a specification of the time conversion information,
149 it must have the following syntax (spaces inserted for clarity):
151 .Bd -literal -offset indent
160 .Bl -tag -width "std and dst" -compact
161 .It Cm std No and Cm dst
162 Three or more bytes that are the designation for the standard
171 is missing, then summer time does not apply in this locale.
172 Upper- and lowercase letters are explicitly allowed.
173 Any characters except a leading colon (:), digits, comma (,), minus (-),
174 plus (+), and NUL bytes are allowed.
176 Indicates the value one must add to the local time to arrive at
177 Coordinated Universal Time.
182 .Bd -literal -offset indent
196 is required and may be a single digit.
206 summer time is assumed to be one hour ahead of standard time.
207 One or more digits may be used; the value is always interpreted as a
209 The hour must be between zero and 24, and the minutes (and
210 seconds) \*(en if present \*(en between zero and 59.
213 the time zone shall be east of the Prime Meridian; otherwise it shall be
214 west (which may be indicated by an optional preceding
217 Indicates when to change to and back from summer time.
222 .Bd -literal -offset indent
234 describes when the change from standard to summer time occurs and the
237 describes when the change back happens.
240 field describes when, in current local time, the change to the other
242 As an extension to POSIX, daylight saving is assumed to be in effect
243 all year if it begins January 1 at 00:00 and ends December 31 at
244 24:00 plus the difference between daylight saving and standard time,
245 leaving no room for standard time in the calendar.
248 is one of the following:
249 .Bl -tag -width "The Julian day" -compact
256 Leap days are not counted; that is, in all years \*(en including leap
257 years \*(en February 28 is day 59 and March 1 is day 60.
258 It is impossible to explicitly refer to the occasional February 29.
260 The zero-based Julian day (0\ \*[Le]
263 Leap days are counted, and it is possible to refer to
266 .It Cm M Ns Ar m No . Ar n No . Ar d
282 \*[Le]\ 12, where week 5 means
283 .Dq the\ last Ar d No day\ in\ month Ar m
284 which may occur in either the fourth or the fifth week).
285 Week 1 is the first week in which the
292 has the same format as
294 except that POSIX does not allow a leading sign
299 As an extension to POSIX, the hours part of
301 can range from \-167 through 167; this allows for unusual rules such as
302 .Dq the Saturday before the first Sunday of March .
309 Here are some examples of
311 values that directly specify the time zone rules; they use some of the
315 stands for US Eastern Standard
316 Time (EST), 5 hours behind UTC, without daylight saving.
317 .It FJT\-12FJST,M11.1.0,M1.3.4/75
318 stands for Fiji Time (FJT) and Fiji Summer Time (FJST), 12 hours ahead
319 of UTC, springing forward on November's first Sunday at 02:00, and
320 falling back on January's third Thursday at 75:00 (i.e., 03:00 on the
321 first Sunday on or after January 18).
322 .It IST\-2IDT,M3.4.4/26,M10.5.0
323 stands for Israel Standard Time (IST) and Israel Daylight Time (IDT),
324 2 hours ahead of UTC, springing forward on March's fourth
325 Thursday at 26:00 (i.e., 02:00 on the first Friday on or after March
326 23), and falling back on October's last Sunday at 02:00.
327 .It WART4WARST,J1/0,J365/25
328 stands for Western Argentina Summer Time (WARST), 3 hours behind UTC.
329 There is a dummy fall-back transition on December 31 at 25:00 daylight
330 saving time (i.e., 24:00 standard time, equivalent to January 1 at
331 00:00 standard time), and a simultaneous spring-forward transition on
332 January 1 at 00:00 standard time, so daylight saving time is in effect
333 all year and the initial
336 .It WGT3WGST,M3.5.0/\-2,M10.5.0/\-1
337 stands for Western Greenland Time (WGT) and Western Greenland Summer
338 Time (WGST), 3 hours behind UTC, where clocks follow the EU rules of
339 springing forward on March's last Sunday at 01:00 UTC (\-02:00 local
340 time) and falling back on October's last Sunday at 01:00 UTC
341 (\-01:00 local time).
348 the rules specified by the
353 .Pa /usr/share/zoneinfo
354 are used, with the standard and summer time offsets from UTC replaced
355 by those specified by the
360 For compatibility with System V Release 3.1, a semicolon (;) may be
363 from the rest of the specification.
365 .Bl -tag -width /usr/share/zoneinfo/posixrules -compact
366 .It Pa /etc/localtime
368 .It Pa /usr/share/zoneinfo
369 time zone information directory
370 .It Pa /usr/share/zoneinfo/posixrules
371 used with POSIX-style TZ's
372 .It Pa /usr/share/zoneinfo/GMT
377 .Pa /usr/share/zoneinfo/GMT
378 is absent, UTC leap seconds are loaded from
379 .Pa /usr/share/zoneinfo/posixrules .
391 .\" @(#)newtzset.3 8.2
392 .\" This file is in the public domain, so clarified as of
393 .\" 2009-05-17 by Arthur David Olson.