Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/lib/libc/time Pull up revisions 1.9-1.10 (requested by ...
details: https://anonhg.NetBSD.org/src/rev/708a06a8f534
branches: netbsd-1-4
changeset: 470913:708a06a8f534
user: he <he%NetBSD.org@localhost>
date: Wed Sep 20 09:48:02 2000 +0000
description:
Pull up revisions 1.9-1.10 (requested by taca):
Fix %k and %e to print a 0 for hour 0, not just spaces. Fixes
PR#5057. Add the C99 %F conversion.
diffstat:
lib/libc/time/strftime.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (43 lines):
diff -r a5e525b7eaba -r 708a06a8f534 lib/libc/time/strftime.c
--- a/lib/libc/time/strftime.c Wed Sep 20 09:40:36 2000 +0000
+++ b/lib/libc/time/strftime.c Wed Sep 20 09:48:02 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: strftime.c,v 1.8.2.1 2000/09/11 20:13:36 he Exp $ */
+/* $NetBSD: strftime.c,v 1.8.2.2 2000/09/20 09:48:02 he Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -38,7 +38,7 @@
#if 0
static char *sccsid = "@(#)strftime.c 5.11 (Berkeley) 2/24/91";
#else
-__RCSID("$NetBSD: strftime.c,v 1.8.2.1 2000/09/11 20:13:36 he Exp $");
+__RCSID("$NetBSD: strftime.c,v 1.8.2.2 2000/09/20 09:48:02 he Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -155,6 +155,10 @@
if (!_conv(t->tm_mday, 2, ' ', pt, ptlim))
return (0);
continue;
+ case 'F':
+ if (!_fmt("%Y-%m-%d", t, pt, ptlim))
+ return (0);
+ continue;
case 'H':
if (!_conv(t->tm_hour, 2, '0', pt, ptlim))
return (0);
@@ -404,8 +408,12 @@
char *p;
buf[sizeof (buf) - 1] = '\0';
- for (p = buf + sizeof(buf) - 2; n > 0 && p > buf; n /= 10, --digits)
+ p = buf + sizeof(buf) - 2;
+ do {
*p-- = n % 10 + '0';
+ n /= 10;
+ --digits;
+ } while (n > 0 && p > buf);
while (p > buf && digits-- > 0)
*p-- = pad;
return (_add(++p, pt, ptlim));
Home |
Main Index |
Thread Index |
Old Index