source: trunk/libs/newlib/src/newlib/libc/time/tzset.c @ 577

Last change on this file since 577 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.3 KB
Line 
1/*
2FUNCTION
3<<tzset>>---set timezone characteristics from TZ environment variable
4
5INDEX
6        tzset
7INDEX
8        _tzset_r
9
10SYNOPSIS
11        #include <time.h>
12        void tzset(void);
13        void _tzset_r (struct _reent *<[reent_ptr]>);
14
15DESCRIPTION
16<<tzset>> examines the TZ environment variable and sets up the three
17external variables: <<_timezone>>, <<_daylight>>, and <<tzname>>.  The
18value of <<_timezone>> shall be the offset from the current time zone
19to GMT.  The value of <<_daylight>> shall be 0 if there is no daylight
20savings time for the current time zone, otherwise it will be non-zero.
21The <<tzname>> array has two entries: the first is the name of the
22standard time zone, the second is the name of the daylight-savings time
23zone.
24
25The TZ environment variable is expected to be in the following POSIX
26format:
27
28  stdoffset1[dst[offset2][,start[/time1],end[/time2]]]
29
30where: 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
43Note that there is no white-space padding between fields.  Also note that
44if TZ is null, the default is Universal GMT which has no daylight-savings
45time.  If TZ is empty, the default EST5EDT is used.
46
47The function <<_tzset_r>> is identical to <<tzset>> only it is reentrant
48and is used for applications that use multiple threads.
49
50RETURNS
51There is no return value.
52
53PORTABILITY
54<<tzset>> is part of the POSIX standard.
55
56Supporting OS subroutine required: None
57*/
58
59#include <_ansi.h>
60#include <reent.h>
61#include <time.h>
62#include "local.h"
63
64void
65_tzset_unlocked (void)
66{
67  _tzset_unlocked_r (_REENT);
68}
69
70void
71tzset (void)
72{
73  TZ_LOCK;
74  _tzset_unlocked_r (_REENT);
75  TZ_UNLOCK;
76}
Note: See TracBrowser for help on using the repository browser.