mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
Update.
2002-03-07 Jakub Jelinek <jakub@redhat.com> * time/tst-posixtz.c (tests): Add new tests. (main): Test whether tzset() sets daylight properly. 2002-03-06 Jakub Jelinek <jakub@redhat.com> * time/tzset.c (tz_compute): Move __daylight, __tzname and __tzname_cur_max setting... (tzset_internal): ...here. 2002-03-06 Jakub Jelinek <jakub@redhat.com> * time/tzset.c (compute_change): Don't return any value. (tz_compute): Likewise. Don't handle southern hemisphere here. (__tz_convert): But here.
This commit is contained in:
parent
bc15410ece
commit
a3931cbec9
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
|||||||
|
2002-03-07 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* time/tst-posixtz.c (tests): Add new tests.
|
||||||
|
(main): Test whether tzset() sets daylight properly.
|
||||||
|
|
||||||
|
2002-03-06 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* time/tzset.c (tz_compute): Move __daylight, __tzname and
|
||||||
|
__tzname_cur_max setting...
|
||||||
|
(tzset_internal): ...here.
|
||||||
|
|
||||||
|
2002-03-06 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* time/tzset.c (compute_change): Don't return any value.
|
||||||
|
(tz_compute): Likewise. Don't handle southern hemisphere here.
|
||||||
|
(__tz_convert): But here.
|
||||||
|
|
||||||
2002-03-11 Ulrich Drepper <drepper@redhat.com>
|
2002-03-11 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* manual/examples/mkfsock.c: Include <string.h> as well.
|
* manual/examples/mkfsock.c: Include <string.h> as well.
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2002-03-11 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* locales/vi_VN: Fix various mistakes and add some more information.
|
||||||
|
Patch by Le Hong Boi <le.hong.boi@quantic.com.vn>.
|
||||||
|
|
||||||
2002-02-28 Ulrich Drepper <drepper@redhat.com>
|
2002-02-28 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* tests-mbwc/dat_strfmon.c (tst_strfmon_loc): Adjust test data for
|
* tests-mbwc/dat_strfmon.c (tst_strfmon_loc): Adjust test data for
|
||||||
|
@ -4,6 +4,8 @@ escape_char /
|
|||||||
% Contributed by Kentaroh Noji <knoji@jp.ibm.com> and
|
% Contributed by Kentaroh Noji <knoji@jp.ibm.com> and
|
||||||
% Tetsuji Orita <orita@jp.ibm.com>.
|
% Tetsuji Orita <orita@jp.ibm.com>.
|
||||||
|
|
||||||
|
% Revised by Le Hong Boi
|
||||||
|
|
||||||
LC_IDENTIFICATION
|
LC_IDENTIFICATION
|
||||||
title "Vietnamese language locale for Vietnam"
|
title "Vietnamese language locale for Vietnam"
|
||||||
source "IBM Globalization Center of Competency, Yamato Software Laboratory"
|
source "IBM Globalization Center of Competency, Yamato Software Laboratory"
|
||||||
@ -54,8 +56,8 @@ mon_thousands_sep "<U002E>"
|
|||||||
mon_grouping 3
|
mon_grouping 3
|
||||||
positive_sign ""
|
positive_sign ""
|
||||||
negative_sign "<U002D>"
|
negative_sign "<U002D>"
|
||||||
int_frac_digits 4
|
int_frac_digits 2
|
||||||
frac_digits 4
|
frac_digits 2
|
||||||
p_cs_precedes 0
|
p_cs_precedes 0
|
||||||
p_sep_by_space 0
|
p_sep_by_space 0
|
||||||
n_cs_precedes 1
|
n_cs_precedes 1
|
||||||
@ -82,24 +84,24 @@ LC_TIME
|
|||||||
% for IBM Class for Unicode/Java
|
% for IBM Class for Unicode/Java
|
||||||
%
|
%
|
||||||
% Abbreviated weekday names (%a)
|
% Abbreviated weekday names (%a)
|
||||||
abday "<U0054><U0068><U0020><U0032><U0020>";/
|
abday "<U0043><U004E><U0020>";/
|
||||||
|
"<U0054><U0068><U0020><U0032><U0020>";/
|
||||||
"<U0054><U0068><U0020><U0033><U0020>";/
|
"<U0054><U0068><U0020><U0033><U0020>";/
|
||||||
"<U0054><U0068><U0020><U0034><U0020>";/
|
"<U0054><U0068><U0020><U0034><U0020>";/
|
||||||
"<U0054><U0068><U0020><U0035><U0020>";/
|
"<U0054><U0068><U0020><U0035><U0020>";/
|
||||||
"<U0054><U0068><U0020><U0036><U0020>";/
|
"<U0054><U0068><U0020><U0036><U0020>";/
|
||||||
"<U0054><U0068><U0020><U0037><U0020>";/
|
"<U0054><U0068><U0020><U0037><U0020>"
|
||||||
"<U0043><U004E><U0020>"
|
|
||||||
%
|
%
|
||||||
% Full weekday names (%A)
|
% Full weekday names (%A)
|
||||||
day "<U0054><U0068><U01B0><U0301><U0020><U0068><U0061><U0069><U0020>";/
|
day "<U0043><U0068><U0075><U0309><U0020><U006E><U0068><U00E2><U0323>/
|
||||||
|
<U0074><U0020>";/
|
||||||
|
"<U0054><U0068><U01B0><U0301><U0020><U0068><U0061><U0069><U0020>";/
|
||||||
"<U0054><U0068><U01B0><U0301><U0020><U0062><U0061><U0020>";/
|
"<U0054><U0068><U01B0><U0301><U0020><U0062><U0061><U0020>";/
|
||||||
"<U0054><U0068><U01B0><U0301><U0020><U0074><U01B0><U0020>";/
|
"<U0054><U0068><U01B0><U0301><U0020><U0074><U01B0><U0020>";/
|
||||||
"<U0054><U0068><U01B0><U0301><U0020><U006E><U0103><U006D><U0020>";/
|
"<U0054><U0068><U01B0><U0301><U0020><U006E><U0103><U006D><U0020>";/
|
||||||
"<U0054><U0068><U01B0><U0301><U0020><U0073><U00E1><U0075><U0020>";/
|
"<U0054><U0068><U01B0><U0301><U0020><U0073><U00E1><U0075><U0020>";/
|
||||||
"<U0054><U0068><U01B0><U0301><U0020><U0062><U0061><U0309><U0079>/
|
"<U0054><U0068><U01B0><U0301><U0020><U0062><U0061><U0309><U0079>/
|
||||||
<U0020>";/
|
<U0020>"
|
||||||
"<U0043><U0068><U0075><U0309><U0020><U006E><U0068><U00E2><U0323>/
|
|
||||||
<U0074><U0020>"
|
|
||||||
%
|
%
|
||||||
% Abbreviated month names (%b)
|
% Abbreviated month names (%b)
|
||||||
abmon "<U0054><U0068><U0067><U0020><U0031>";/
|
abmon "<U0054><U0068><U0067><U0020><U0031>";/
|
||||||
@ -155,12 +157,12 @@ t_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>/
|
|||||||
<U0020><U0025><U005A>"
|
<U0020><U0025><U005A>"
|
||||||
%
|
%
|
||||||
% Appropriate 12 h time representation (%r)
|
% Appropriate 12 h time representation (%r)
|
||||||
t_fmt_ampm ""
|
t_fmt_ampm ""
|
||||||
%
|
%
|
||||||
% Appropriate date representation (date(1)) "%a %b %e %H:%M:%S %Z %Y"
|
% Appropriate date representation (date(1)) "%H:%M:%S %a %e %b %Y %Z"
|
||||||
date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
|
date_fmt "<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053>/
|
||||||
<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
|
<U0020><U0025><U0061><U0020><U0025><U0065><U0020><U0025><U0062>/
|
||||||
<U0025><U005A><U0020><U0025><U0059>"
|
<U0020><U0025><U0059><U0020><U0025><U005A>"
|
||||||
END LC_TIME
|
END LC_TIME
|
||||||
|
|
||||||
|
|
||||||
@ -186,10 +188,10 @@ LC_NAME
|
|||||||
name_fmt "<U0025><U0070><U0025><U0074><U0025><U0066><U0025><U0074>/
|
name_fmt "<U0025><U0070><U0025><U0074><U0025><U0066><U0025><U0074>/
|
||||||
<U0025><U0067>"
|
<U0025><U0067>"
|
||||||
name_gen ""
|
name_gen ""
|
||||||
name_mr "<U004D><U0072><U002E>"
|
name_mr "<U00D4><U002E>"
|
||||||
name_mrs "<U004D><U0072><U0073><U002E>"
|
name_mrs "<U0042><U002E>"
|
||||||
name_miss "<U004D><U0069><U0073><U0073><U002E>"
|
name_miss "<U0043><U002E>"
|
||||||
name_ms "<U004D><U0073><U002E>"
|
name_ms ""
|
||||||
|
|
||||||
END LC_NAME
|
END LC_NAME
|
||||||
|
|
||||||
@ -199,6 +201,8 @@ LC_ADDRESS
|
|||||||
% LC_ADDRESS
|
% LC_ADDRESS
|
||||||
postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
|
postal_fmt "<U0025><U007A><U0025><U0063><U0025><U0054><U0025><U0073>/
|
||||||
<U0025><U0062><U0025><U0065><U0025><U0072>"
|
<U0025><U0062><U0025><U0065><U0025><U0072>"
|
||||||
|
country_name "<U0056><U0069><U1EC7><U0074><U0020><U006E><U0061><U006D>"
|
||||||
|
lang_name "<U0056><U0069><U1EC7><U0074><U0020><U006E><U0067><U1EEF>"
|
||||||
|
|
||||||
END LC_ADDRESS
|
END LC_ADDRESS
|
||||||
|
|
||||||
@ -209,6 +213,7 @@ LC_TELEPHONE
|
|||||||
tel_int_fmt "<U002B><U0025><U0063><U0020><U003B><U0025><U0061><U0020>/
|
tel_int_fmt "<U002B><U0025><U0063><U0020><U003B><U0025><U0061><U0020>/
|
||||||
<U003B><U0025><U006C>"
|
<U003B><U0025><U006C>"
|
||||||
int_prefix "<U0038><U0034>"
|
int_prefix "<U0038><U0034>"
|
||||||
|
int_select "<U0030><U0030>"
|
||||||
|
|
||||||
END LC_TELEPHONE
|
END LC_TELEPHONE
|
||||||
|
|
||||||
|
@ -14,6 +14,14 @@ struct
|
|||||||
"1998/10/25 21:54:09 dst=1 zone=AEDST" },
|
"1998/10/25 21:54:09 dst=1 zone=AEDST" },
|
||||||
{ 924864849L, "AEST-10AEDST-11,M10.5.0,M3.5.0",
|
{ 924864849L, "AEST-10AEDST-11,M10.5.0,M3.5.0",
|
||||||
"1999/04/23 20:54:09 dst=0 zone=AEST" },
|
"1999/04/23 20:54:09 dst=0 zone=AEST" },
|
||||||
|
{ 919973892L, "AEST-10AEDST-11,M10.5.0,M3.5.0",
|
||||||
|
"1999/02/26 07:18:12 dst=1 zone=AEDST" },
|
||||||
|
{ 909312849L, "EST+5EDT,M4.1.0/2,M10.5.0/2",
|
||||||
|
"1998/10/25 05:54:09 dst=0 zone=EST" },
|
||||||
|
{ 924864849L, "EST+5EDT,M4.1.0/2,M10.5.0/2",
|
||||||
|
"1999/04/23 06:54:09 dst=1 zone=EDT" },
|
||||||
|
{ 919973892L, "EST+5EDT,M4.1.0/2,M10.5.0/2",
|
||||||
|
"1999/02/25 15:18:12 dst=0 zone=EST" },
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -51,5 +59,30 @@ main (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setenv ("TZ", "Universal", 1);
|
||||||
|
localtime (&tests[0].when);
|
||||||
|
printf ("TZ = \"Universal\" daylight %d tzname = { \"%s\", \"%s\" }",
|
||||||
|
daylight, tzname[0], tzname[1]);
|
||||||
|
if (! daylight)
|
||||||
|
puts (", OK");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = 1;
|
||||||
|
puts (", FAIL");
|
||||||
|
}
|
||||||
|
|
||||||
|
setenv ("TZ", "AEST-10AEDST-11,M10.5.0,M3.5.0", 1);
|
||||||
|
tzset ();
|
||||||
|
printf ("TZ = \"AEST-10AEDST-11,M10.5.0,M3.5.0\" daylight %d"
|
||||||
|
" tzname = { \"%s\", \"%s\" }", daylight, tzname[0], tzname[1]);
|
||||||
|
if (daylight
|
||||||
|
&& strcmp (tzname[0], "AEST") == 0 && strcmp (tzname[1], "AEDST") == 0)
|
||||||
|
puts (", OK");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = 1;
|
||||||
|
puts (", FAIL");
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
120
time/tzset.c
120
time/tzset.c
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
|
/* Copyright (C) 1991-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -69,8 +69,8 @@ typedef struct
|
|||||||
static tz_rule tz_rules[2];
|
static tz_rule tz_rules[2];
|
||||||
|
|
||||||
|
|
||||||
static int compute_change __P ((tz_rule *rule, int year)) internal_function;
|
static void compute_change __P ((tz_rule *rule, int year)) internal_function;
|
||||||
static int tz_compute __P ((const struct tm *tm))
|
static void tz_compute __P ((const struct tm *tm))
|
||||||
internal_function;
|
internal_function;
|
||||||
static void tzset_internal __P ((int always)) internal_function;
|
static void tzset_internal __P ((int always)) internal_function;
|
||||||
|
|
||||||
@ -121,6 +121,23 @@ __tzstring (const char *s)
|
|||||||
return new->data;
|
return new->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Maximum length of a timezone name. tzset_internal keeps this up to date
|
||||||
|
(never decreasing it) when ! __use_tzfile.
|
||||||
|
tzfile.c keeps it up to date when __use_tzfile. */
|
||||||
|
size_t __tzname_cur_max;
|
||||||
|
|
||||||
|
long int
|
||||||
|
__tzname_max ()
|
||||||
|
{
|
||||||
|
__libc_lock_lock (tzset_lock);
|
||||||
|
|
||||||
|
tzset_internal (0);
|
||||||
|
|
||||||
|
__libc_lock_unlock (tzset_lock);
|
||||||
|
|
||||||
|
return __tzname_cur_max;
|
||||||
|
}
|
||||||
|
|
||||||
static char *old_tz;
|
static char *old_tz;
|
||||||
|
|
||||||
/* Interpret the TZ envariable. */
|
/* Interpret the TZ envariable. */
|
||||||
@ -186,7 +203,7 @@ tzset_internal (always)
|
|||||||
tz_rules[0].offset = tz_rules[1].offset = 0L;
|
tz_rules[0].offset = tz_rules[1].offset = 0L;
|
||||||
tz_rules[0].change = tz_rules[1].change = (time_t) -1;
|
tz_rules[0].change = tz_rules[1].change = (time_t) -1;
|
||||||
tz_rules[0].computed_for = tz_rules[1].computed_for = 0;
|
tz_rules[0].computed_for = tz_rules[1].computed_for = 0;
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear out old state and reset to unnamed UTC. */
|
/* Clear out old state and reset to unnamed UTC. */
|
||||||
@ -198,7 +215,7 @@ tzset_internal (always)
|
|||||||
|
|
||||||
if (sscanf (tz, "%[^0-9,+-]", tzbuf) != 1 ||
|
if (sscanf (tz, "%[^0-9,+-]", tzbuf) != 1 ||
|
||||||
(l = strlen (tzbuf)) < 3)
|
(l = strlen (tzbuf)) < 3)
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
tz_rules[0].name = __tzstring (tzbuf);
|
tz_rules[0].name = __tzstring (tzbuf);
|
||||||
|
|
||||||
@ -206,7 +223,7 @@ tzset_internal (always)
|
|||||||
|
|
||||||
/* Figure out the standard offset from UTC. */
|
/* Figure out the standard offset from UTC. */
|
||||||
if (*tz == '\0' || (*tz != '+' && *tz != '-' && !isdigit (*tz)))
|
if (*tz == '\0' || (*tz != '+' && *tz != '-' && !isdigit (*tz)))
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
if (*tz == '-' || *tz == '+')
|
if (*tz == '-' || *tz == '+')
|
||||||
tz_rules[0].offset = *tz++ == '-' ? 1L : -1L;
|
tz_rules[0].offset = *tz++ == '-' ? 1L : -1L;
|
||||||
@ -215,7 +232,7 @@ tzset_internal (always)
|
|||||||
switch (sscanf (tz, "%hu:%hu:%hu", &hh, &mm, &ss))
|
switch (sscanf (tz, "%hu:%hu:%hu", &hh, &mm, &ss))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return;
|
goto out;
|
||||||
case 1:
|
case 1:
|
||||||
mm = 0;
|
mm = 0;
|
||||||
case 2:
|
case 2:
|
||||||
@ -387,32 +404,26 @@ tzset_internal (always)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
/* We know the offset now, set `__timezone'. */
|
__daylight = tz_rules[0].offset != tz_rules[1].offset;
|
||||||
__timezone = -tz_rules[0].offset;
|
__timezone = -tz_rules[0].offset;
|
||||||
}
|
__tzname[0] = (char *) tz_rules[0].name;
|
||||||
|
__tzname[1] = (char *) tz_rules[1].name;
|
||||||
/* Maximum length of a timezone name. __tz_compute keeps this up to date
|
|
||||||
(never decreasing it) when ! __use_tzfile.
|
|
||||||
tzfile.c keeps it up to date when __use_tzfile. */
|
|
||||||
size_t __tzname_cur_max;
|
|
||||||
|
|
||||||
long int
|
{
|
||||||
__tzname_max ()
|
/* Keep __tzname_cur_max up to date. */
|
||||||
{
|
size_t len0 = strlen (__tzname[0]);
|
||||||
__libc_lock_lock (tzset_lock);
|
size_t len1 = strlen (__tzname[1]);
|
||||||
|
if (len0 > __tzname_cur_max)
|
||||||
tzset_internal (0);
|
__tzname_cur_max = len0;
|
||||||
|
if (len1 > __tzname_cur_max)
|
||||||
__libc_lock_unlock (tzset_lock);
|
__tzname_cur_max = len1;
|
||||||
|
}
|
||||||
return __tzname_cur_max;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out the exact time (as a time_t) in YEAR
|
/* Figure out the exact time (as a time_t) in YEAR
|
||||||
when the change described by RULE will occur and
|
when the change described by RULE will occur and
|
||||||
put it in RULE->change, saving YEAR in RULE->computed_for.
|
put it in RULE->change, saving YEAR in RULE->computed_for. */
|
||||||
Return nonzero if successful, zero on failure. */
|
static void
|
||||||
static int
|
|
||||||
internal_function
|
internal_function
|
||||||
compute_change (rule, year)
|
compute_change (rule, year)
|
||||||
tz_rule *rule;
|
tz_rule *rule;
|
||||||
@ -422,7 +433,7 @@ compute_change (rule, year)
|
|||||||
|
|
||||||
if (year != -1 && rule->computed_for == year)
|
if (year != -1 && rule->computed_for == year)
|
||||||
/* Operations on times in 2 BC will be slower. Oh well. */
|
/* Operations on times in 2 BC will be slower. Oh well. */
|
||||||
return 1;
|
return;
|
||||||
|
|
||||||
/* First set T to January 1st, 0:00:00 GMT in YEAR. */
|
/* First set T to January 1st, 0:00:00 GMT in YEAR. */
|
||||||
if (year > 1970)
|
if (year > 1970)
|
||||||
@ -498,45 +509,18 @@ compute_change (rule, year)
|
|||||||
|
|
||||||
rule->change = t - rule->offset + rule->secs;
|
rule->change = t - rule->offset + rule->secs;
|
||||||
rule->computed_for = year;
|
rule->computed_for = year;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Figure out the correct timezone for TM and set `__tzname',
|
/* Figure out the correct timezone for TM and set `__tzname',
|
||||||
`__timezone', and `__daylight' accordingly. Return nonzero on
|
`__timezone', and `__daylight' accordingly. */
|
||||||
success, zero on failure. */
|
static void
|
||||||
static int
|
|
||||||
internal_function
|
internal_function
|
||||||
tz_compute (tm)
|
tz_compute (tm)
|
||||||
const struct tm *tm;
|
const struct tm *tm;
|
||||||
{
|
{
|
||||||
if (! compute_change (&tz_rules[0], 1900 + tm->tm_year)
|
compute_change (&tz_rules[0], 1900 + tm->tm_year);
|
||||||
|| ! compute_change (&tz_rules[1], 1900 + tm->tm_year))
|
compute_change (&tz_rules[1], 1900 + tm->tm_year);
|
||||||
return 0;
|
|
||||||
/* We have to distinguish between northern and southern hemisphere.
|
|
||||||
For the latter the daylight saving time ends in the next year.
|
|
||||||
It is easier to detect this after first computing the time for the
|
|
||||||
wrong year since now we simply can compare the times to switch. */
|
|
||||||
if (tz_rules[0].change > tz_rules[1].change
|
|
||||||
&& ! compute_change (&tz_rules[1], 1900 + tm->tm_year + 1))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
__daylight = tz_rules[0].offset != tz_rules[1].offset;
|
|
||||||
__timezone = -tz_rules[0].offset;
|
|
||||||
__tzname[0] = (char *) tz_rules[0].name;
|
|
||||||
__tzname[1] = (char *) tz_rules[1].name;
|
|
||||||
|
|
||||||
{
|
|
||||||
/* Keep __tzname_cur_max up to date. */
|
|
||||||
size_t len0 = strlen (__tzname[0]);
|
|
||||||
size_t len1 = strlen (__tzname[1]);
|
|
||||||
if (len0 > __tzname_cur_max)
|
|
||||||
__tzname_cur_max = len0;
|
|
||||||
if (len1 > __tzname_cur_max)
|
|
||||||
__tzname_cur_max = len1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reinterpret the TZ environment variable and set `tzname'. */
|
/* Reinterpret the TZ environment variable and set `tzname'. */
|
||||||
@ -590,8 +574,10 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (! (__offtime (timer, 0, tp) && tz_compute (tp)))
|
if (! __offtime (timer, 0, tp))
|
||||||
tp = NULL;
|
tp = NULL;
|
||||||
|
else
|
||||||
|
tz_compute (tp);
|
||||||
leap_correction = 0L;
|
leap_correction = 0L;
|
||||||
leap_extra_secs = 0;
|
leap_extra_secs = 0;
|
||||||
}
|
}
|
||||||
@ -602,8 +588,18 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
|
|||||||
{
|
{
|
||||||
if (!__use_tzfile)
|
if (!__use_tzfile)
|
||||||
{
|
{
|
||||||
int isdst = (*timer >= tz_rules[0].change
|
int isdst;
|
||||||
&& *timer < tz_rules[1].change);
|
|
||||||
|
/* We have to distinguish between northern and southern
|
||||||
|
hemisphere. For the latter the daylight saving time
|
||||||
|
ends in the next year. */
|
||||||
|
if (__builtin_expect (tz_rules[0].change
|
||||||
|
> tz_rules[1].change, 0))
|
||||||
|
isdst = (*timer < tz_rules[1].change
|
||||||
|
|| *timer >= tz_rules[0].change);
|
||||||
|
else
|
||||||
|
isdst = (*timer >= tz_rules[0].change
|
||||||
|
&& *timer < tz_rules[1].change);
|
||||||
tp->tm_isdst = isdst;
|
tp->tm_isdst = isdst;
|
||||||
tp->tm_zone = __tzname[isdst];
|
tp->tm_zone = __tzname[isdst];
|
||||||
tp->tm_gmtoff = tz_rules[isdst].offset;
|
tp->tm_gmtoff = tz_rules[isdst].offset;
|
||||||
|
Loading…
Reference in New Issue
Block a user