- /* This lock is defined in tzset.c and locks all the data defined there
- and in tzfile.c; the internal functions do no locking themselves.
- This lock is only taken here and in `tzset'. */
- __libc_lock_define (extern, __tzset_lock)
- extern int __use_tzfile;
- extern int __tz_compute __P ((time_t timer, struct tm *tp));
- extern int __tzfile_compute __P ((time_t timer,
- long int *leap_correct, int *leap_hit));
- long int leap_correction;
- int leap_extra_secs;
-
- if (timer == NULL)
- {
- __set_errno (EINVAL);
- return NULL;
- }
-
- __libc_lock_lock (__tzset_lock);
-
- /* Make sure the database is initialized. */
- __tzset ();
-
- if (__use_tzfile)
- {
- if (! __tzfile_compute (*timer, &leap_correction, &leap_extra_secs))
- tp = NULL;
- }
- else
- {
- tp = __gmtime_r (timer, tp);
- if (tp && ! __tz_compute (*timer, tp))
- tp = NULL;
- leap_correction = 0L;
- leap_extra_secs = 0;
- }
-
- if (tp)
- {
- __offtime (timer, __timezone - leap_correction, tp);
- tp->tm_sec += leap_extra_secs;
- tp->tm_isdst = __daylight;
- tp->tm_gmtoff = __timezone;
- tp->tm_zone = __tzname[__daylight];
- }
+ return __tz_convert (t, 1, tp);
+}
+weak_alias (__localtime_r, localtime_r)