Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/time Switch to using isleap() and isleap_sum() macr...
details: https://anonhg.NetBSD.org/src/rev/00a14a631642
branches: trunk
changeset: 339329:00a14a631642
user: ginsbach <ginsbach%NetBSD.org@localhost>
date: Mon Jul 13 17:45:16 2015 +0000
description:
Switch to using isleap() and isleap_sum() macros from <tzfile.h> to be
consistent with strftime.c and localtime.c.
diffstat:
lib/libc/time/strptime.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diffs (60 lines):
diff -r 02df708a44ec -r 00a14a631642 lib/libc/time/strptime.c
--- a/lib/libc/time/strptime.c Mon Jul 13 13:57:44 2015 +0000
+++ b/lib/libc/time/strptime.c Mon Jul 13 17:45:16 2015 +0000
@@ -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 @@
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 @@
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 @@
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 @@
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;
Home |
Main Index |
Thread Index |
Old Index