Loading...
--- Libc/Libc-262/stdtime/strftime.3
+++ Libc/Libc-498/stdtime/strftime.3
@@ -34,27 +34,43 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)strftime.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdtime/strftime.3,v 1.18.2.7 2001/12/14 18:33:59 ru Exp $
-.\"
-.Dd October 4, 1997
+.\" $FreeBSD: src/lib/libc/stdtime/strftime.3,v 1.34 2004/07/02 23:52:12 ru Exp $
+.\"
+.Dd January 4, 2003
.Dt STRFTIME 3
.Os
.Sh NAME
-.Nm strftime
+.Nm strftime ,
+.Nm strftime_l
.Nd format date and time
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In time.h
.Ft size_t
-.Fn strftime "char *buf" "size_t maxsize" "const char *format" "const struct tm *timeptr"
+.Fo strftime
+.Fa "char *restrict s"
+.Fa "size_t maxsize"
+.Fa "const char *restrict format"
+.Fa "const struct tm *restrict timeptr"
+.Fc
+.In time.h
+.In xlocale.h
+.Ft size_t
+.Fo strftime_l
+.Fa "char *restrict s"
+.Fa "size_t maxsize"
+.Fa "const char *restrict format"
+.Fa "const struct tm *restrict timeptr"
+.Fa "locale_t loc"
+.Fc
.Sh DESCRIPTION
The
.Fn strftime
function formats the information from
.Fa timeptr
into the buffer
-.Fa buf
+.Fa s ,
according to the string pointed to by
.Fa format .
.Pp
@@ -76,7 +92,15 @@
.Fn strftime
returns the number of characters in the array, not counting the
terminating NUL.
-Otherwise, zero is returned and the buffer contents is indeterminate.
+Otherwise, zero is returned and the buffer contents are indeterminate.
+.Pp
+Although the
+.Fn strftime
+function uses the current locale, the
+.Fn strftime_l
+function may be passed a locale directly. See
+.Xr xlocale 3
+for more information.
.Pp
The conversion specifications are copied to the buffer after expansion
as follows:-
@@ -85,25 +109,17 @@
is replaced by national representation of the full weekday name.
.It Cm %a
is replaced by national representation of
-the abbreviated weekday name, where the abbreviation
-is the first three characters.
+the abbreviated weekday name.
.It Cm \&%B
is replaced by national representation of the full month name.
.It Cm %b
is replaced by national representation of
-the abbreviated month name, where the abbreviation is
-the first three characters.
+the abbreviated month name.
.It Cm \&%C
is replaced by (year / 100) as decimal number; single
digits are preceded by a zero.
.It Cm %c
is replaced by national representation of time and date.
-The format is similar to that produced by
-.Xr ctime 3
-and is
-equivalent to "%a %Ef %T %Y".
-It also implies the
-"3+1+6+1+8+1+4" format of output.
.It Cm \&%D
is equivalent to
.Dq Li %m/%d/%y .
@@ -118,14 +134,15 @@
are supposed to provide alternate
representations.
.Pp
-Additionly %Ef implemented to represent short month name / day
-order of the date, %EF to represent long month name / day
-order
-and %OB to represent alternative months names
+Additionly %OB implemented
+to represent alternative months names
(used standalone, without day mentioned).
.It Cm %e
is replaced by the day of month as a decimal number (1-31); single
digits are preceded by a blank.
+.It Cm \&%F
+is equivalent to
+.Dq Li %Y-%m-%d .
.It Cm \&%G
is replaced by a year as a decimal number with century.
This year is the one that contains the greater part of
@@ -186,7 +203,8 @@
as a decimal number (1-7).
.It Cm \&%V
is replaced by the week number of the year (Monday as the first day of
-the week) as a decimal number (01-53). If the week containing January
+the week) as a decimal number (01-53).
+If the week containing January
1 has four or more days in the new year, then it is week 1; otherwise
it is the last week of the previous year, and the next week is week 1.
.It Cm %v
@@ -226,7 +244,9 @@
.Xr printf 1 ,
.Xr ctime 3 ,
.Xr printf 3 ,
-.Xr strptime 3
+.Xr strptime 3 ,
+.Xr wcsftime 3 ,
+.Xr xlocale 3
.Sh STANDARDS
The
.Fn strftime
@@ -253,13 +273,20 @@
.Ql %u ,
.Ql \&%V ,
.Ql %z ,
+and
.Ql %+ .
.Pp
The peculiar week number and year in the replacements of
.Ql %G ,
-.Ql %g
+.Ql %g ,
and
.Ql \&%V
are defined in ISO 8601: 1988.
.Sh BUGS
There is no conversion specification for the phase of the moon.
+.Pp
+The
+.Fn strftime
+function does not correctly handle multibyte characters in the
+.Fa format
+argument.