/* Convert *TP to a time_t value. */ time_t mktime(struct tm *tp) { #ifdef _LIBC /* POSIX.1 8.1.1 requires that whenever mktime() is called, the time zone names contained in the external variable 'tzname' shall be set as if the tzset() function had been called. */ __tzset (); #endif
/* Interpret the TZ envariable. */ staticvoid internal_function tzset_internal(int always, int explicit) { staticint is_initialized; constchar *tz;
if (is_initialized && !always) return; is_initialized = 1;
/* 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";
/* 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;
/* Check whether the value changed since the last run. */ if (old_tz != NULL && tz != NULL && strcmp (tz, old_tz) == 0) /* No change, simply return. */ return;
if (tz == NULL) /* No user specification; use the site-wide default. */ tz = TZDEFAULT;
tz_rules[0].name = NULL; tz_rules[1].name = NULL;
/* Save the value of `tz'. */ free (old_tz); old_tz = tz ? __strdup (tz) : NULL;
/* Try to read a data file. */ __tzfile_read (tz, 0, NULL); if (__use_tzfile) return;
/* No data file found. Default to UTC if nothing specified. */
# Where to install the timezone data files(which are machine-independent). ifndef zonedir zonedir = $(datadir)/zoneinfo endif inst_zonedir = $(install_root)$(zonedir)
1 2 3 4 5
# Where to install machine-independent data files. # These are the timezone database, and the locale database. ifndef datadir datadir = $(prefix)/share endif