]> git.saurik.com Git - apple/libc.git/blobdiff - stdtime/FreeBSD/strftime.3
Libc-1353.100.2.tar.gz
[apple/libc.git] / stdtime / FreeBSD / strftime.3
index c3f803dc7113e8e4fca6d1aced7a6ab7efac2346..5454a074c19e5d714e96fd05639e84590cdc8cab 100644 (file)
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)strftime.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdtime/strftime.3,v 1.34 2004/07/02 23:52:12 ru Exp $
+.\" $FreeBSD: src/lib/libc/stdtime/strftime.3,v 1.40 2008/05/16 04:33:04 grog Exp $
 .\"
-.Dd January 4, 2003
+.Dd November 4, 2004
 .Dt STRFTIME 3
 .Os
 .Sh NAME
-.Nm strftime
+.Nm strftime ,
+.Nm strftime_l
 .Nd format date and time
 .Sh LIBRARY
 .Lb libc
 .In time.h
 .Ft size_t
 .Fo strftime
-.Fa "char * restrict buf"
+.Fa "char *restrict s"
 .Fa "size_t maxsize"
-.Fa "const char * restrict format"
-.Fa "const struct tm * restrict timeptr"
+.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
@@ -59,7 +66,7 @@ The
 function formats the information from
 .Fa timeptr
 into the buffer
-.Fa buf
+.Fa s ,
 according to the string pointed to by
 .Fa format .
 .Pp
@@ -83,6 +90,14 @@ returns the number of characters in the array, not counting the
 terminating NUL.
 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:-
 .Bl -tag -width "xxxx"
@@ -106,7 +121,7 @@ is equivalent to
 .Dq Li %m/%d/%y .
 .It Cm %d
 is replaced by the day of the month as a decimal number (01-31).
-.It Cm \&%E* Cm \&%O*
+.It Cm %E* %O*
 POSIX locale extensions.
 The sequences
 %Ec %EC %Ex %EX %Ey %EY
@@ -115,11 +130,11 @@ The sequences
 are supposed to provide alternate
 representations.
 .Pp
-Additionly %OB implemented
+Additionally %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
+is replaced by the day of the month as a decimal number (1-31); single
 digits are preceded by a blank.
 .It Cm \&%F
 is equivalent to
@@ -135,7 +150,8 @@ but as a decimal number without century (00-99).
 .It Cm \&%H
 is replaced by the hour (24-hour clock) as a decimal number (00-23).
 .It Cm %h
-the same as %b.
+the same as
+.Cm %b .
 .It Cm \&%I
 is replaced by the hour (12-hour clock) as a decimal number (01-12).
 .It Cm %j
@@ -152,13 +168,14 @@ is replaced by the minute as a decimal number (00-59).
 is replaced by the month as a decimal number (01-12).
 .It Cm %n
 is replaced by a newline.
-.It Cm \&%O*
-the same as %E*.
+.It Cm %O*
+the same as
+.Cm %E* .
 .It Cm %p
 is replaced by national representation of either
-"ante meridiem"
+"ante meridiem" (a.m.)
 or
-"post meridiem"
+"post meridiem" (p.m.)
 as appropriate.
 .It Cm \&%R
 is equivalent to
@@ -207,7 +224,7 @@ is replaced by the year with century as a decimal number.
 is replaced by the year without century as a decimal number (00-99).
 .It Cm \&%Z
 is replaced by the time zone name.
-.It Cm \&%z
+.It Cm %z
 is replaced by the time zone offset from UTC; a leading plus sign stands for
 east of UTC, a minus sign for west of UTC, hours and minutes follow
 with two digits each and no delimiter between them (common form for
@@ -216,6 +233,15 @@ RFC 822 date headers).
 is replaced by national representation of the date and time
 (the format is similar to that produced by
 .Xr date 1 ) .
+.It Cm %-*
+GNU libc extension.
+Do not do any padding when performing numerical outputs.
+.It Cm %_*
+GNU libc extension.
+Explicitly specify space for padding.
+.It Cm %0*
+GNU libc extension.
+Explicitly specify zero for padding.
 .It Cm %%
 is replaced by
 .Ql % .
@@ -226,7 +252,8 @@ is replaced by
 .Xr ctime 3 ,
 .Xr printf 3 ,
 .Xr strptime 3 ,
-.Xr wcsftime 3
+.Xr wcsftime 3 ,
+.Xr xlocale 3
 .Sh STANDARDS
 The
 .Fn strftime
@@ -253,11 +280,12 @@ with a lot of extensions including
 .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.