From 80fd73873bd51e58039983a9416ef3bb97bdac57 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 6 Oct 1995 04:50:55 +0000 Subject: Fri Sep 29 03:43:51 1995 Paul Eggert Rewrite mktime from scratch for performance, and for correctness in the presence of leap seconds. * time/mktime.c (ydhms_tm_diff, not_equal_tm, print_tm, check_result): New functions. (LEAP_SECONDS_POSSIBLE, CHAR_BIT, INT_MIN, INT_MAX, TIME_T_MIN, TIME_T_MAX, TM_YEAR_BASE, EPOCH_YEAR): New macros. , : New #includes. (main): Support tests with given broken-down value; support benchmarks. (__mon_lengths, debugging_enabled, printtm, dist_tm, doit, do_normalization, normalize, BAD_STRUCT_TM, SKIP_VALUE, ): Remove. * time/time.h, time/mktime.c (__mktime_internal): New offset arg. * time/mktime.c (mktime), time/timegm.c (timegm): Use it. * time/mktime.c (__mon_yday): New variable; replaces `__mon_lengths'. time/offtime.c (__offtime), time/tzset.c (compute_change): Use it. * time/offtime.c (__offtime): Remove useless assignment `tp->tm_isdst = -1'. * manual/maint.texi: Update credits. Fri Oct 6 00:28:53 1995 Roland McGrath * sysdeps/unix/common/readv.S: Moved to sysdeps/unix/bsd. * sysdeps/unix/common/writev.S: Moved to sysdeps/unix/bsd. * sysdeps/unix/sysv/linux/readv.c: File removed. * sysdeps/unix/sysv/linux/writev.c: File removed. * sysdeps/unix/configure.in: Check for readv and writev syscalls. * sysdeps/unix/configure.in: If eval doesn't set $unix_srcname, set it to $unix_syscall instead of $unix_function. --- time/tzset.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'time/tzset.c') diff --git a/time/tzset.c b/time/tzset.c index ccaffd9c4a..813609c230 100644 --- a/time/tzset.c +++ b/time/tzset.c @@ -25,7 +25,7 @@ Cambridge, MA 02139, USA. */ #include /* Defined in mktime.c. */ -extern CONST unsigned short int __mon_lengths[2][12]; +extern CONST unsigned short int __mon_yday[2][13]; #define NOID #include "tzfile.h" @@ -403,10 +403,11 @@ DEFUN(compute_change, (rule, year), tz_rule *rule AND int year) /* Mm.n.d - Nth "Dth day" of month M. */ { register int i, d, m1, yy0, yy1, yy2, dow; + register CONST unsigned short int *myday = + &__mon_yday[__isleap (year)][rule->m]; /* First add SECSPERDAY for each day in months before M. */ - for (i = 0; i < rule->m - 1; ++i) - t += __mon_lengths[__isleap (year)][i] * SECSPERDAY; + t += myday[-1] * SECSPERDAY; /* Use Zeller's Congruence to get day-of-week of first day of month. */ m1 = (rule->m + 9) % 12 + 1; @@ -424,7 +425,7 @@ DEFUN(compute_change, (rule, year), tz_rule *rule AND int year) d += 7; for (i = 1; i < rule->n; ++i) { - if (d + 7 >= __mon_lengths[__isleap (year)][rule->m - 1]) + if (d + 7 >= myday[0] - myday[-1]) break; d += 7; } -- cgit 1.4.1