diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2002-04-17 21:23:31 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2002-04-17 21:23:31 +0000 |
commit | 10d002160949c985e6f99fb8d647d5e3c67ef554 (patch) | |
tree | 6ffe46b0b090120c2a251ffc2ce19574fb5f1dfb /newlib/libc/time/tzset.c | |
parent | a26c50352b4db457813ef86fb053bd838d310d30 (diff) | |
download | cygnal-10d002160949c985e6f99fb8d647d5e3c67ef554.tar.gz cygnal-10d002160949c985e6f99fb8d647d5e3c67ef554.tar.bz2 cygnal-10d002160949c985e6f99fb8d647d5e3c67ef554.zip |
2002-04-17 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/time.h (tzset, _tzset_r): Added prototypes.
(strptime): Moved prototype to be within !__STRICT_ANSI__.
(_tzname, _daylight, _timezone): No long __CYGWIN__ only.
(tzname): Defined for all platforms.
(daylight, timezone): Defined only for CYGWIN.
* libc/sys/linux/machine/i386/crt0.c: Add call to tzset() after
environment set up.
* libc/stdlib/setenv_r.c (_setenv_r): Call tzset() if the TZ
environment variable is set.
* libc/time/Makefile.am: Add support for tzset.c, tzlock.c, and
tzset_r.c.
* libc/time/Makefile.in: Regenerated.
* libc/time/gmtime.c (gmtime): Changed to call gmtime_r.
* libc/time/gmtime_r.c (gmtime_r): Changed to call _mktm_r.
* libc/time/lcltime_r.c (lcltime_r): Ditto.
* libc/time/local.h: New local header file.
* libc/time/mktime.c (mktime): Add timezone support.
* libc/time/mktm_r.c: New file which is the common engine
for gmtime_r and lcltime_r. This code has timezone support.
* libc/time/strftime.c (strftime): Add %Z timezone support.
* libc/time/tzlock.c: New file containing timezone lock stubs.
* libc/time/tzset.c: New file containing tzset() routine.
* libc/time/tzset_r.c: New file containing _tzset_r and
internal routine for calculating timezone changes for specified year.
Diffstat (limited to 'newlib/libc/time/tzset.c')
-rw-r--r-- | newlib/libc/time/tzset.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/newlib/libc/time/tzset.c b/newlib/libc/time/tzset.c new file mode 100644 index 000000000..c70e3ee6e --- /dev/null +++ b/newlib/libc/time/tzset.c @@ -0,0 +1,72 @@ +/* +FUNCTION +<<tzset>>---set timezone characteristics from TZ environment variable + +INDEX + tzset + +ANSI_SYNOPSIS + #include <time.h> + void tzset(void); + void _tzset_r (struct _reent *); + +TRAD_SYNOPSIS + #include <time.h> + void tzset(); + void _tzset_r (reent_ptr) + struct _reent *reent_ptr; + +DESCRIPTION +<<tzset>> examines the TZ environment variable and sets up the three +external variables: <<_timezone>>, <<_daylight>>, and <<tzname>>. The +value of <<_timezone>> shall be the offset from the current time zone +to GMT. The value of <<_daylight>> shall be 0 if there is no daylight +savings time for the current time zone, otherwise it will be non-zero. +The <<tzname>> array has two entries: the first is the name of the +standard time zone, the second is the name of the daylight-savings time +zone. + +The TZ environment variable is expected to be in the following POSIX +format: + + stdoffset1[dst[offset2][,start[/time1],end[/time2]]] + +where: std is the name of the standard time-zone (minimum 3 chars) + offset1 is the value to add to local time to arrive at Universal time + it has the form: hh[:mm[:ss]] + dst is the name of the alternate (daylight-savings) time-zone (min 3 chars) + offset2 is the value to add to local time to arrive at Universal time + it has the same format as the std offset + start is the day that the alternate time-zone starts + time1 is the optional time that the alternate time-zone starts + (this is in local time and defaults to 02:00:00 if not specified) + end is the day that the alternate time-zone ends + time2 is the time that the alternate time-zone ends + (it is in local time and defaults to 02:00:00 if not specified) + +Note that there is no white-space padding between fields. Also note that +if TZ is null, the default is Universal GMT which has no daylight-savings +time. If TZ is empty, the default EST5EDT is used. + +The function <<_tzset_r>> is identical to <<tzset>> only it is reentrant +and is used for applications that use multiple threads. + +RETURNS +There is no return value. + +PORTABILITY +<<tzset>> is part of the POSIX standard. + +Supporting OS subroutine required: None +*/ + +#include <_ansi.h> +#include <reent.h> +#include <time.h> +#include "local.h" + +_VOID +_DEFUN_VOID (tzset) +{ + _tzset_r (_REENT); +} |