static void compute_change __P ((tz_rule *rule, int year)) internal_function;
static void tz_compute __P ((const struct tm *tm))
internal_function;
-static void tzset_internal __P ((int always)) internal_function;
+static void tzset_internal __P ((int always, int explicit)) internal_function;
\f
/* List of buffers containing time zone strings. */
struct tzstring_l
{
__libc_lock_lock (tzset_lock);
- tzset_internal (0);
+ tzset_internal (0, 0);
__libc_lock_unlock (tzset_lock);
/* Interpret the TZ envariable. */
static void
internal_function
-tzset_internal (always)
+tzset_internal (always, explicit)
int always;
+ int explicit;
{
static int is_initialized;
register const char *tz;
/* Examine the TZ environment variable. */
tz = getenv ("TZ");
+ if (tz == NULL && !explicit)
+ /* Use the site-wide default. This is a file name which means we
+ would not see changes to the file if we compare only the file
+ name for change. We want to notice file changes if tzset() has
+ been called explicitly. Leave TZ as NULL in this case. */
+ tz = TZDEFAULT;
if (tz && *tz == '\0')
/* User specified the empty string; use UTC explicitly. */
tz = "Universal";
{
__libc_lock_lock (tzset_lock);
- tzset_internal (1);
+ tzset_internal (1, 1);
if (!__use_tzfile)
{
POSIX.1 8.3.7.2 says that localtime_r is not required to set tzname.
This is a good idea since this allows at least a bit more parallelism.
By analogy we apply the same rule to gmtime_r. */
- tzset_internal (tp == &_tmbuf);
+ tzset_internal (tp == &_tmbuf, 0);
if (__use_tzfile)
__tzfile_compute (*timer, use_localtime, &leap_correction,