Cygwin: mmap: use 64K pages for bookkeeping, second attempt
[newlib-cygwin.git] / newlib / libc / time / tzset.c
blob77accbfb04852f4c19566a247bc42e54893f94fd
1 /*
2 FUNCTION
3 <<tzset>>---set timezone characteristics from <[TZ]> environment variable
5 INDEX
6 tzset
7 INDEX
8 _tzset_r
10 SYNOPSIS
11 #include <time.h>
12 void tzset(void);
13 void _tzset_r (struct _reent *<[reent_ptr]>);
15 DESCRIPTION
16 <<tzset>> examines the <[TZ]> environment variable and sets up the three
17 external variables: <<_timezone>>, <<_daylight>>, and <<tzname>>.
18 The value of <<_timezone>> shall be the offset from the current time
19 to Universal Time.
20 The value of <<_daylight>> shall be 0 if there is no daylight savings
21 time for the current time zone, otherwise it will be non-zero.
22 The <<tzname>> array has two entries: the first is the designation of the
23 standard time period, the second is the designation of the alternate time
24 period.
26 The <[TZ]> environment variable is expected to be in the following POSIX
27 format (spaces inserted for clarity):
29 <[std]> <[offset1]> [<[dst]> [<[offset2]>] [,<[start]> [/<[time1]>], <[end]> [/<[time2]>]]]
31 where:
33 <[std]> is the designation for the standard time period (minimum 3,
34 maximum <<TZNAME_MAX>> bytes) in one of two forms:
36 *- quoted within angle bracket '<' '>' characters: portable numeric
37 sign or alphanumeric characters in the current locale; the
38 quoting characters are not included in the designation
40 *- unquoted: portable alphabetic characters in the current locale
42 <[offset1]> is the value to add to local standard time to get Universal Time;
43 it has the format:
45 [<[S]>]<[hh]>[:<[mm]>[:<[ss]>]]
47 where:
49 <[S]> is an optional numeric sign character; if negative '-', the
50 time zone is East of the International Reference
51 Meridian; else it is positive and West, and '+' may be used
53 <[hh]> is the required numeric hour between 0 and 24
55 <[mm]> is the optional numeric minute between 0 and 59
57 <[ss]> is the optional numeric second between 0 and 59
59 <[dst]> is the designation of the alternate (daylight saving or
60 summer) time period, with the same limits and forms as
61 the standard time period designation
63 <[offset2]> is the value to add to local alternate time to get
64 Universal Time; it has the same format as <[offset1]>
66 <[start]> is the date in the year that alternate time starts;
67 the form may be one of:
68 (quotes "'" around characters below are used only to distinguish literals)
70 <[n]> zero based Julian day (0-365), counting February 29 Leap days
72 'J'<[n]> one based Julian day (1-365), not counting February 29 Leap
73 days; in all years day 59 is February 28 and day 60 is March 1
75 'M'<[m]>'.'<[w]>'.'<[d]>
76 month <[m]> (1-12) week <[w]> (1-5) day <[d]> (0-6) where week 1 is
77 the first week in month <[m]> with day <[d]>; week 5 is the last
78 week in the month; day 0 is Sunday
80 <[time1]> is the optional local time that alternate time starts, in
81 the same format as <[offset1]> without any sign, and defaults
82 to 02:00:00
84 <[end]> is the date in the year that alternate time ends, in the same
85 forms as <[start]>
87 <[time2]> is the optional local time that alternate time ends, in
88 the same format as <[offset1]> without any sign, and
89 defaults to 02:00:00
91 Note that there is no white-space padding between fields. Also note that
92 if <[TZ]> is null, the default is Universal Time which has no daylight saving
93 time. If <[TZ]> is empty, the default EST5EDT is used.
95 The function <<_tzset_r>> is identical to <<tzset>> only it is reentrant
96 and is used for applications that use multiple threads.
98 RETURNS
99 There is no return value.
101 PORTABILITY
102 <<tzset>> is part of the POSIX standard.
104 Supporting OS subroutine required: None
107 #include <_ansi.h>
108 #include <reent.h>
109 #include <time.h>
110 #include "local.h"
112 void
113 _tzset_unlocked (void)
115 _tzset_unlocked_r (_REENT);
118 void
119 tzset (void)
121 TZ_LOCK;
122 _tzset_unlocked_r (_REENT);
123 TZ_UNLOCK;