1 | /* |
---|
2 | FUNCTION |
---|
3 | <<tzset>>---set timezone characteristics from TZ environment variable |
---|
4 | |
---|
5 | INDEX |
---|
6 | tzset |
---|
7 | INDEX |
---|
8 | _tzset_r |
---|
9 | |
---|
10 | SYNOPSIS |
---|
11 | #include <time.h> |
---|
12 | void tzset(void); |
---|
13 | void _tzset_r (struct _reent *<[reent_ptr]>); |
---|
14 | |
---|
15 | DESCRIPTION |
---|
16 | <<tzset>> examines the TZ environment variable and sets up the three |
---|
17 | external variables: <<_timezone>>, <<_daylight>>, and <<tzname>>. The |
---|
18 | value of <<_timezone>> shall be the offset from the current time zone |
---|
19 | to GMT. The value of <<_daylight>> shall be 0 if there is no daylight |
---|
20 | savings time for the current time zone, otherwise it will be non-zero. |
---|
21 | The <<tzname>> array has two entries: the first is the name of the |
---|
22 | standard time zone, the second is the name of the daylight-savings time |
---|
23 | zone. |
---|
24 | |
---|
25 | The TZ environment variable is expected to be in the following POSIX |
---|
26 | format: |
---|
27 | |
---|
28 | stdoffset1[dst[offset2][,start[/time1],end[/time2]]] |
---|
29 | |
---|
30 | where: std is the name of the standard time-zone (minimum 3 chars) |
---|
31 | offset1 is the value to add to local time to arrive at Universal time |
---|
32 | it has the form: hh[:mm[:ss]] |
---|
33 | dst is the name of the alternate (daylight-savings) time-zone (min 3 chars) |
---|
34 | offset2 is the value to add to local time to arrive at Universal time |
---|
35 | it has the same format as the std offset |
---|
36 | start is the day that the alternate time-zone starts |
---|
37 | time1 is the optional time that the alternate time-zone starts |
---|
38 | (this is in local time and defaults to 02:00:00 if not specified) |
---|
39 | end is the day that the alternate time-zone ends |
---|
40 | time2 is the time that the alternate time-zone ends |
---|
41 | (it is in local time and defaults to 02:00:00 if not specified) |
---|
42 | |
---|
43 | Note that there is no white-space padding between fields. Also note that |
---|
44 | if TZ is null, the default is Universal GMT which has no daylight-savings |
---|
45 | time. If TZ is empty, the default EST5EDT is used. |
---|
46 | |
---|
47 | The function <<_tzset_r>> is identical to <<tzset>> only it is reentrant |
---|
48 | and is used for applications that use multiple threads. |
---|
49 | |
---|
50 | RETURNS |
---|
51 | There is no return value. |
---|
52 | |
---|
53 | PORTABILITY |
---|
54 | <<tzset>> is part of the POSIX standard. |
---|
55 | |
---|
56 | Supporting OS subroutine required: None |
---|
57 | */ |
---|
58 | |
---|
59 | #include <_ansi.h> |
---|
60 | #include <reent.h> |
---|
61 | #include <time.h> |
---|
62 | #include "local.h" |
---|
63 | |
---|
64 | void |
---|
65 | _tzset_unlocked (void) |
---|
66 | { |
---|
67 | _tzset_unlocked_r (_REENT); |
---|
68 | } |
---|
69 | |
---|
70 | void |
---|
71 | tzset (void) |
---|
72 | { |
---|
73 | TZ_LOCK; |
---|
74 | _tzset_unlocked_r (_REENT); |
---|
75 | TZ_UNLOCK; |
---|
76 | } |
---|