mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
Update.
1998-11-13 Ulrich Drepper <drepper@cygnus.com> * libio/bits/stdio.h: Correct and improve fread_unlocked and fwrite_unlocked optimizations. * time/tzfile.c (__tzfile_read): Set __tzname based on last names in time not to last entries in the file. (__tzfile_compute): Likewise. Fix for PR libc/863. * timezone/Makefile: Generate GB timezone data for test. * timezone/tst-timezone.c: More tests for DST switching time (disabled for now). 1998-11-13 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * sysdeps/gnu/bits/utmp.h: Rename pad member of struct utmp to
This commit is contained in:
parent
7f2a1e3cf8
commit
a3e0e9ae47
17
ChangeLog
17
ChangeLog
@ -1,4 +1,17 @@
|
||||
Fri Nov 13 11:57:21 1998 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
|
||||
1998-11-13 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* libio/bits/stdio.h: Correct and improve fread_unlocked and
|
||||
fwrite_unlocked optimizations.
|
||||
|
||||
* time/tzfile.c (__tzfile_read): Set __tzname based on last names
|
||||
in time not to last entries in the file.
|
||||
(__tzfile_compute): Likewise. Fix for PR libc/863.
|
||||
|
||||
* timezone/Makefile: Generate GB timezone data for test.
|
||||
* timezone/tst-timezone.c: More tests for DST switching time (disabled
|
||||
for now).
|
||||
|
||||
1998-11-13 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
|
||||
|
||||
* sysdeps/unix/sysv/linux/m68k/sysdep.h (INLINE_SYSCALL): Remove
|
||||
d0 from clobber list.
|
||||
@ -21,7 +34,7 @@ Fri Nov 13 11:57:21 1998 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
|
||||
__exit_status with `__'. Rename pad member of struct utmpx to
|
||||
__unused.
|
||||
(RUN_LVL): Define unconditionally.
|
||||
* sysdeps/gnu/bits/utmp.h: Rename pad member of struct utmpx to
|
||||
* sysdeps/gnu/bits/utmp.h: Rename pad member of struct utmp to
|
||||
__unused.
|
||||
|
||||
1998-11-12 Philip Blundell <philb@gnu.org>
|
||||
|
@ -16,11 +16,12 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define NOID
|
||||
@ -172,7 +173,7 @@ __tzfile_read (const char *file)
|
||||
|
||||
if (num_transitions > 0)
|
||||
{
|
||||
transitions = (time_t *) malloc (num_transitions * sizeof(time_t));
|
||||
transitions = (time_t *) malloc (num_transitions * sizeof (time_t));
|
||||
if (transitions == NULL)
|
||||
goto lose;
|
||||
type_idxs = (unsigned char *) malloc (num_transitions);
|
||||
@ -219,7 +220,7 @@ __tzfile_read (const char *file)
|
||||
processed when sizeof (time_t) > 4. */
|
||||
i = num_transitions;
|
||||
while (i-- > 0)
|
||||
transitions[i] = decode ((char *) transitions + i*4);
|
||||
transitions[i] = decode ((char *) transitions + i * 4);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_types; ++i)
|
||||
@ -270,12 +271,36 @@ __tzfile_read (const char *file)
|
||||
|
||||
fclose (f);
|
||||
|
||||
/* First "register" all timezone names. */
|
||||
for (i = 0; i < num_types; ++i)
|
||||
(void) __tzstring (&zone_names[types[i].idx]);
|
||||
|
||||
/* Find the standard and daylight time offsets used by the rule file.
|
||||
We choose the offsets in the types of each flavor that are
|
||||
transitioned to earliest in time. */
|
||||
__tzname[0] = NULL;
|
||||
__tzname[1] = NULL;
|
||||
for (i = 0; i < num_types; ++i)
|
||||
__tzname[types[i].isdst] = __tzstring (&zone_names[types[i].idx]);
|
||||
for (i = num_transitions; i > 0; )
|
||||
{
|
||||
int type = type_idxs[--i];
|
||||
int dst = types[type].isdst;
|
||||
int idx = types[type].idx;
|
||||
|
||||
if (__tzname[dst] == NULL)
|
||||
{
|
||||
__tzname[dst] = __tzstring (&zone_names[idx]);
|
||||
|
||||
if (__tzname[1 - dst] != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (__tzname[0] == NULL)
|
||||
{
|
||||
/* This should only happen if there are no transition rules.
|
||||
In this case there should be only one single type. */
|
||||
assert (num_types == 1);
|
||||
__tzname[0] = __tzstring (zone_names);
|
||||
}
|
||||
if (__tzname[1] == NULL)
|
||||
__tzname[1] = __tzname[0];
|
||||
|
||||
@ -438,9 +463,29 @@ __tzfile_compute (time_t timer, int use_localtime,
|
||||
struct ttinfo *info = find_transition (timer);
|
||||
__daylight = rule_stdoff != rule_dstoff;
|
||||
__timezone = -rule_stdoff;
|
||||
__tzname[0] = NULL;
|
||||
__tzname[1] = NULL;
|
||||
for (i = 0; i < num_types; ++i)
|
||||
__tzname[types[i].isdst] = __tzstring (&zone_names[types[i].idx]);
|
||||
for (i = num_transitions; i > 0; )
|
||||
{
|
||||
int type = type_idxs[--i];
|
||||
int dst = types[type].isdst;
|
||||
int idx = types[type].idx;
|
||||
|
||||
if (__tzname[dst] == NULL)
|
||||
{
|
||||
__tzname[dst] = __tzstring (&zone_names[idx]);
|
||||
|
||||
if (__tzname[1 - dst] != NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (__tzname[0] == NULL)
|
||||
{
|
||||
/* This should only happen if there are no transition rules.
|
||||
In this case there should be only one single type. */
|
||||
assert (num_types == 1);
|
||||
__tzname[0] = __tzstring (zone_names);
|
||||
}
|
||||
if (__tzname[1] == NULL)
|
||||
/* There is no daylight saving time. */
|
||||
__tzname[1] = __tzname[0];
|
||||
|
@ -53,7 +53,7 @@ define nl
|
||||
|
||||
|
||||
endef
|
||||
ifndef avoid-generated
|
||||
ifndef no_deps
|
||||
-include $(addprefix $(objpfx)z.,$(tzfiles))
|
||||
endif
|
||||
|
||||
@ -178,7 +178,7 @@ $(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC)
|
||||
$(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \
|
||||
Europe/Berlin Universal \
|
||||
Australia/Melbourne \
|
||||
America/Sao_Paulo Asia/Tokyo)
|
||||
America/Sao_Paulo Asia/Tokyo GB)
|
||||
|
||||
test-tz-ENV = TZDIR=$(testdata)
|
||||
tst-timezone-ENV = TZDIR=$(testdata)
|
||||
@ -204,6 +204,8 @@ $(testdata)/America/Sao_Paulo: southamerica $(objpfx)zic $(leapseconds) \
|
||||
$(build-testdata)
|
||||
$(testdata)/Asia/Tokyo: asia $(objpfx)zic $(leapseconds) yearistype
|
||||
$(build-testdata)
|
||||
$(testdata)/GB: europe $(objpfx)zic $(leapseconds) yearistype
|
||||
$(build-testdata)
|
||||
|
||||
|
||||
$(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
|
||||
|
@ -39,6 +39,7 @@ static const struct test_times tests[] =
|
||||
{ "Universal", 0, 0, {"UTC", "UTC" }},
|
||||
{ "Australia/Melbourne", 1, -36000, { "EST", "EST" }},
|
||||
{ "America/Sao_Paulo", 1, 10800, {"EST", "EDT" }},
|
||||
{ "America/Chicago", 1, 21600, {"CST", "CDT" }},
|
||||
{ "America/Los_Angeles", 1, 28800, {"PST", "PDT" }},
|
||||
{ "Asia/Tokyo", 0, -32400, {"JST", "JST" }},
|
||||
{ NULL, 0, 0 }
|
||||
@ -113,5 +114,43 @@ main (int argc, char ** argv)
|
||||
check_tzvars (pt->name, pt->daylight, pt->timezone, pt->tzname);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* From a port of Scott Harrington <seh4@ix.netcom.com> to the timezone
|
||||
mailing list. */
|
||||
{
|
||||
struct tm tmBuf = {0, 0, 0, 10, 3, 98, 0, 0, -1};
|
||||
char buf[200];
|
||||
putenv ("TZ=GB");
|
||||
t = mktime (&tmBuf);
|
||||
snprintf (buf, sizeof (buf), "TZ=%s %ld %d %d %d %d %d %d %d %d %d",
|
||||
getenv ("TZ"), t,
|
||||
tmBuf.tm_sec, tmBuf.tm_min, tmBuf.tm_hour,
|
||||
tmBuf.tm_mday, tmBuf.tm_mon, tmBuf.tm_year,
|
||||
tmBuf.tm_wday, tmBuf.tm_yday, tmBuf.tm_isdst);
|
||||
fputs (buf, stdout);
|
||||
puts (" should be");
|
||||
puts ("TZ=GB 892162800 0 0 0 10 3 98 5 99 1");
|
||||
failed |= strcmp (buf, "TZ=GB 892162800 0 0 0 10 3 98 5 99 1") != 0;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
{
|
||||
struct tm tmBuf = {0, 0, 0, 10, 3, 98, 0, 0, -1};
|
||||
char buf[200];
|
||||
putenv ("TZ=GMT");
|
||||
t = mktime (&tmBuf);
|
||||
snprintf (buf, sizeof (buf), "TZ=%s %ld %d %d %d %d %d %d %d %d %d",
|
||||
getenv ("TZ"), t,
|
||||
tmBuf.tm_sec, tmBuf.tm_min, tmBuf.tm_hour,
|
||||
tmBuf.tm_mday, tmBuf.tm_mon, tmBuf.tm_year,
|
||||
tmBuf.tm_wday, tmBuf.tm_yday, tmBuf.tm_isdst);
|
||||
fputs (buf, stdout);
|
||||
puts (" should be");
|
||||
puts ("TZ=GMT 892166400 0 0 0 10 3 98 5 99 0");
|
||||
failed |= strcmp (buf, "TZ=GMT 892166400 0 0 0 10 3 98 5 99 0") != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return failed ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user