mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 10:50:07 +00:00
Sun Jun 16 00:40:20 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* time/Makefile ($(installed-localtime-file)): If target exists, do nothing but print a message; if not, make it an absolute symlink. * time/tzset.c (__tzset): After stripping leading :, call __tzfile_read on TZ even if it's empty or null. * time/tzfile.c (__tzfile_read): Use "Universal" if passed "".
This commit is contained in:
parent
5fbef18864
commit
a3b5844025
@ -1,3 +1,12 @@
|
||||
Sun Jun 16 00:40:20 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
||||
|
||||
* time/Makefile ($(installed-localtime-file)): If target exists, do
|
||||
nothing but print a message; if not, make it an absolute symlink.
|
||||
|
||||
* time/tzset.c (__tzset): After stripping leading :, call
|
||||
__tzfile_read on TZ even if it's empty or null.
|
||||
* time/tzfile.c (__tzfile_read): Use "Universal" if passed "".
|
||||
|
||||
Sat Jun 15 18:13:43 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
|
||||
|
||||
* hurd/Makefile (routines): Add get-host, set-host.
|
||||
|
@ -119,7 +119,8 @@ target-zone-flavor = $(filter /posix /right, \
|
||||
|
||||
ifdef localtime
|
||||
$(installed-localtime-file): $(zonedir)/$(localtime) $(objpfx)zic
|
||||
$(zic-cmd) -l $(localtime)
|
||||
if test -r $@; then echo Site timezone NOT reset to Factory.; else \
|
||||
ln -s -f $< $@; fi
|
||||
endif
|
||||
ifdef posixrules
|
||||
$(installed-posixrules-file): $(zonedir)/$(posixrules) $(objpfx)zic
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -103,8 +103,12 @@ DEFUN(__tzfile_read, (file), CONST char *file)
|
||||
free((PTR) leaps);
|
||||
leaps = NULL;
|
||||
|
||||
if (file == NULL || *file == '\0')
|
||||
if (file == NULL)
|
||||
/* No user specification; use the site-wide default. */
|
||||
file = TZDEFAULT;
|
||||
else if (*file == '\0')
|
||||
/* User specified the empty string; use UTC explicitly. */
|
||||
file = "Universal";
|
||||
|
||||
if (*file != '/')
|
||||
{
|
||||
@ -224,7 +228,7 @@ DEFUN(__tzfile_read, (file), CONST char *file)
|
||||
(void) fclose(f);
|
||||
|
||||
compute_tzname_max (chars);
|
||||
|
||||
|
||||
__use_tzfile = 1;
|
||||
return;
|
||||
|
||||
|
64
time/tzset.c
64
time/tzset.c
@ -99,45 +99,41 @@ DEFUN_VOID(__tzset)
|
||||
/* Examine the TZ environment variable. */
|
||||
tz = getenv ("TZ");
|
||||
|
||||
if (tz != NULL)
|
||||
{
|
||||
/* A leading colon means "implementation defined syntax".
|
||||
We ignore the colon and always use the same algorithm:
|
||||
try a data file, and if none exists parse the 1003.1 syntax. */
|
||||
if (*tz == ':')
|
||||
++tz;
|
||||
/* A leading colon means "implementation defined syntax".
|
||||
We ignore the colon and always use the same algorithm:
|
||||
try a data file, and if none exists parse the 1003.1 syntax. */
|
||||
if (tz && *tz == ':')
|
||||
++tz;
|
||||
|
||||
__tzfile_read (tz);
|
||||
if (__use_tzfile)
|
||||
{
|
||||
__tzset_run = 1;
|
||||
return;
|
||||
}
|
||||
/* Try to read a data file. */
|
||||
__tzfile_read (tz);
|
||||
if (__use_tzfile)
|
||||
{
|
||||
__tzset_run = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* No data file found. Default to UTC if nothing specified. */
|
||||
|
||||
if (tz == NULL || *tz == '\0')
|
||||
{
|
||||
__tzfile_read((char *) NULL);
|
||||
if (!__use_tzfile)
|
||||
{
|
||||
const char UTC[] = "UTC";
|
||||
size_t len = sizeof UTC;
|
||||
tz_rules[0].name = (char *) malloc(len);
|
||||
if (tz_rules[0].name == NULL)
|
||||
return;
|
||||
tz_rules[1].name = (char *) malloc(len);
|
||||
if (tz_rules[1].name == NULL)
|
||||
return;
|
||||
memcpy ((PTR) tz_rules[0].name, UTC, len);
|
||||
memcpy ((PTR) tz_rules[1].name, UTC, len);
|
||||
tz_rules[0].type = tz_rules[1].type = J0;
|
||||
tz_rules[0].m = tz_rules[0].n = tz_rules[0].d = 0;
|
||||
tz_rules[1].m = tz_rules[1].n = tz_rules[1].d = 0;
|
||||
tz_rules[0].secs = tz_rules[1].secs = 0;
|
||||
tz_rules[0].offset = tz_rules[1].offset = 0L;
|
||||
tz_rules[0].change = tz_rules[1].change = (time_t) -1;
|
||||
tz_rules[0].computed_for = tz_rules[1].computed_for = 0;
|
||||
}
|
||||
static const char UTC[] = "UTC";
|
||||
size_t len = sizeof UTC;
|
||||
tz_rules[0].name = (char *) malloc(len);
|
||||
if (tz_rules[0].name == NULL)
|
||||
return;
|
||||
tz_rules[1].name = (char *) malloc(len);
|
||||
if (tz_rules[1].name == NULL)
|
||||
return;
|
||||
memcpy ((PTR) tz_rules[0].name, UTC, len);
|
||||
memcpy ((PTR) tz_rules[1].name, UTC, len);
|
||||
tz_rules[0].type = tz_rules[1].type = J0;
|
||||
tz_rules[0].m = tz_rules[0].n = tz_rules[0].d = 0;
|
||||
tz_rules[1].m = tz_rules[1].n = tz_rules[1].d = 0;
|
||||
tz_rules[0].secs = tz_rules[1].secs = 0;
|
||||
tz_rules[0].offset = tz_rules[1].offset = 0L;
|
||||
tz_rules[0].change = tz_rules[1].change = (time_t) -1;
|
||||
tz_rules[0].computed_for = tz_rules[1].computed_for = 0;
|
||||
__tzset_run = 1;
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user