SCCS-vsn: lib/libc/string/strftime.c 5.2
SCCS-vsn: lib/libc/string/strftime.3 5.2
.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
-.\" @(#)strftime.3 5.1 (Berkeley) %G%
+.\" @(#)strftime.3 5.2 (Berkeley) %G%
.\"
.TH STRFTIME 3 "%Q"
.AT 3
.\"
.TH STRFTIME 3 "%Q"
.AT 3
.B %B
is replaced by the full month name.
.TP
.B %B
is replaced by the full month name.
.TP
is replaced by the abbreviated month name, where the abbreviation is
the first three characters.
.TP
.B %c
is equivalent to ``%a %b %d %X %Z %Y''.
.TP
is replaced by the abbreviated month name, where the abbreviation is
the first three characters.
.TP
.B %c
is equivalent to ``%a %b %d %X %Z %Y''.
.TP
+.B %D
+is replaced by the date in the format ``mm/dd/yy''.
+.TP
.B %d
is replaced by the day of the month as a decimal number (01-31).
.TP
.B %d
is replaced by the day of the month as a decimal number (01-31).
.TP
.B %j
is replaced by the day of the year as a decimal number (001-366).
.TP
.B %j
is replaced by the day of the year as a decimal number (001-366).
.TP
+.B %M
+is replaced by the minute as a decimal number (00-59).
+.TP
.B %m
is replaced by the month as a decimal number (01-12).
.TP
.B %m
is replaced by the month as a decimal number (01-12).
.TP
-.B %M
-is replaced by the minute as a decimal number (00-59).
+.B %n
+is replaced by a newline.
.TP
.B %p
is replaced by either ``AM'' or ``PM'' as appropriate.
.TP
.TP
.B %p
is replaced by either ``AM'' or ``PM'' as appropriate.
.TP
+.B %R
+is equivalent to ``%H:%M''.
+.TP
+.B %r
+is equivalent to ``%I:%M:%S %p''.
+.TP
+.B %t
+is replaced by a tab.
+.TP
.B %S
is replaced by the second as a decimal number (00-60).
.TP
.B %S
is replaced by the second as a decimal number (00-60).
.TP
+.B %T or %X
+is equivalent to ``%H:%M:%S''.
+.TP
.B %U
is replaced by the week number of the year (Sunday as the first day of
the week) as a decimal number (00-53).
.B %U
is replaced by the week number of the year (Sunday as the first day of
the week) as a decimal number (00-53).
is replaced by the weekday (Sunday as the first day of the week)
as a decimal number (0-6).
.TP
is replaced by the weekday (Sunday as the first day of the week)
as a decimal number (0-6).
.TP
-.B %X
-is equivalent to ``%H:%M:%S''.
-.TP
.B %x
is equivalent to ``%a %b %d %Y''.
.TP
.B %x
is equivalent to ``%a %b %d %Y''.
.TP
*/
#if defined(LIBC_SCCS) && !defined(lint)
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strftime.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)strftime.c 5.2 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
return(0);
continue;
case 'b':
return(0);
continue;
case 'b':
if (!_add(bfmt[t->tm_mon]))
return(0);
continue;
if (!_add(bfmt[t->tm_mon]))
return(0);
continue;
if (!_fmt("%x %X %Z %Y", t))
return(0);
continue;
if (!_fmt("%x %X %Z %Y", t))
return(0);
continue;
+ case 'D':
+ if (!_fmt("%m/%d/%y", t))
+ return(0);
+ continue;
case 'd':
if (!_conv(t->tm_mday, 2))
return(0);
case 'd':
if (!_conv(t->tm_mday, 2))
return(0);
if (!_conv(t->tm_mon + 1, 2))
return(0);
continue;
if (!_conv(t->tm_mon + 1, 2))
return(0);
continue;
+ case 'n':
+ if (!_add("\n"))
+ return(0);
+ continue;
case 'p':
if (!_add(t->tm_hour >= 12 ? "AM" : "PM"))
return(0);
continue;
case 'p':
if (!_add(t->tm_hour >= 12 ? "AM" : "PM"))
return(0);
continue;
+ case 'R':
+ if (!_fmt("%H:%M", t))
+ return(0);
+ continue;
+ case 'r':
+ if (!_fmt("%I:%M:%S %p", t))
+ return(0);
+ continue;
case 'S':
if (!_conv(t->tm_sec, 2))
return(0);
continue;
case 'S':
if (!_conv(t->tm_sec, 2))
return(0);
continue;
+ case 'T':
+ case 'X':
+ if (!_fmt("%H:%M:%S", t))
+ return(0);
+ continue;
+ case 't':
+ if (!_add("\t"))
+ return(0);
+ continue;
case 'U':
if (!_conv((t->tm_yday + 7 - t->tm_wday) / 7,
2))
case 'U':
if (!_conv((t->tm_yday + 7 - t->tm_wday) / 7,
2))
if (!_conv(t->tm_wday, 1))
return(0);
continue;
if (!_conv(t->tm_wday, 1))
return(0);
continue;
- case 'X':
- if (!_fmt("%H:%M:%S", t))
- return(0);
- continue;
case 'x':
if (!_fmt("%a %b %d", t))
return(0);
case 'x':
if (!_fmt("%a %b %d", t))
return(0);