summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-10 06:19:34 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-06-10 06:19:34 +0000
commit50cf773ce874b899c477500f5742d063ff08c2c5 (patch)
tree2f45af612fac4408a2a829379b5ab2b09acb6c2a
parente73ca26e76e4f4a73a79c4ddf1365857cd8e38b2 (diff)
fix %V
-rw-r--r--lib/libc/string/strftime.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libc/string/strftime.c b/lib/libc/string/strftime.c
index b6326f274ed..b1fa97cae11 100644
--- a/lib/libc/string/strftime.c
+++ b/lib/libc/string/strftime.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strftime.c,v 1.4 1996/03/25 21:17:36 tholo Exp $ */
+/* $OpenBSD: strftime.c,v 1.5 1996/06/10 06:19:33 deraadt Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -35,7 +35,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)strftime.c 5.11 (Berkeley) 2/24/91";*/
-static char *rcsid = "$Id: strftime.c,v 1.4 1996/03/25 21:17:36 tholo Exp $";
+static char *rcsid = "$Id: strftime.c,v 1.5 1996/06/10 06:19:33 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/localedef.h>
@@ -220,7 +220,11 @@ _fmt(format, t)
int week = MON_WEEK(t);
- if (((t->tm_yday + 7 - (t->tm_wday + 1)) % 7) >= 4) {
+ int days = (((t)->tm_yday + 7 - \
+ ((t)->tm_wday ? (t)->tm_wday - 1 : 6)) % 7);
+
+
+ if (days >= 4) {
week++;
} else if (week == 0) {
week = 53;