Module Name:    src
Committed By:   ginsbach
Date:           Mon Jul 13 17:45:16 UTC 2015

Modified Files:
        src/lib/libc/time: strptime.c

Log Message:
Switch to using isleap() and isleap_sum() macros from <tzfile.h> to be
consistent with strftime.c and localtime.c.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/lib/libc/time/strptime.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/time/strptime.c
diff -u src/lib/libc/time/strptime.c:1.42 src/lib/libc/time/strptime.c:1.43
--- src/lib/libc/time/strptime.c:1.42	Wed Jul  8 19:48:20 2015
+++ src/lib/libc/time/strptime.c	Mon Jul 13 17:45:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: strptime.c,v 1.42 2015/07/08 19:48:20 ginsbach Exp $	*/
+/*	$NetBSD: strptime.c,v 1.43 2015/07/13 17:45:16 ginsbach Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
@@ -31,13 +31,12 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strptime.c,v 1.42 2015/07/08 19:48:20 ginsbach Exp $");
+__RCSID("$NetBSD: strptime.c,v 1.43 2015/07/13 17:45:16 ginsbach Exp $");
 #endif
 
 #include "namespace.h"
 #include <sys/localedef.h>
 #include <sys/types.h>
-#include <sys/clock.h>
 #include <ctype.h>
 #include <locale.h>
 #include <string.h>
@@ -104,7 +103,7 @@ static int
 first_wday_of(int yr)
 {
 	return ((2 * (3 - (yr / 100) % 4)) + (yr % 100) + ((yr % 100) /  4) +
-	    (is_leap_year(yr) ? 6 : 0) + 1) % 7;
+	    (isleap(yr) ? 6 : 0) + 1) % 7;
 }
 
 char *
@@ -587,7 +586,7 @@ literal:
 
 	if (!HAVE_YDAY(state) && HAVE_YEAR(state)) {
 		if (HAVE_MON(state) && HAVE_MDAY(state)) {
-			tm->tm_yday =  start_of_month[is_leap_year(tm->tm_year +
+			tm->tm_yday =  start_of_month[isleap_sum(tm->tm_year,
 			    TM_YEAR_BASE)][tm->tm_mon] + (tm->tm_mday - 1);
 			state |= S_YDAY;
 		} else if (day_offset != -1) {
@@ -610,7 +609,7 @@ literal:
 		int isleap;
 		if (!HAVE_MON(state)) {
 			i = 0;
-			isleap = is_leap_year(tm->tm_year + TM_YEAR_BASE);
+			isleap = isleap_sum(tm->tm_year, TM_YEAR_BASE);
 			while (tm->tm_yday >= start_of_month[isleap][i])
 				i++;
 			if (i > 12) {
@@ -622,7 +621,7 @@ literal:
 			state |= S_MON;
 		}
 		if (!HAVE_MDAY(state)) {
-			isleap = is_leap_year(tm->tm_year + TM_YEAR_BASE);
+			isleap = isleap_sum(tm->tm_year, TM_YEAR_BASE);
 			tm->tm_mday = tm->tm_yday -
 			    start_of_month[isleap][tm->tm_mon] + 1;
 			state |= S_MDAY;

Reply via email to