aboutsummaryrefslogtreecommitdiffstats
path: root/missing/strftime.3
diff options
context:
space:
mode:
Diffstat (limited to 'missing/strftime.3')
-rw-r--r--missing/strftime.3259
1 files changed, 259 insertions, 0 deletions
diff --git a/missing/strftime.3 b/missing/strftime.3
new file mode 100644
index 00000000..b61ed029
--- /dev/null
+++ b/missing/strftime.3
@@ -0,0 +1,259 @@
+.TH STRFTIME 3
+.SH NAME
+strftime \- generate formatted time information
+.SH SYNOPSIS
+.ft B
+.nf
+#include <sys/types.h>
+#include <time.h>
+.sp
+size_t strftime(char *s, size_t maxsize, const char *format,
+ const struct tm *timeptr);
+.SH DESCRIPTION
+The following description is transcribed verbatim from the December 7, 1988
+draft standard for ANSI C.
+This draft is essentially identical in technical content
+to the final version of the standard.
+.LP
+The
+.B strftime
+function places characters into the array pointed to by
+.B s
+as controlled by the string pointed to by
+.BR format .
+The format shall be a multibyte character sequence, beginning and ending in
+its initial shift state.
+The
+.B format
+string consists of zero or more conversion specifiers and ordinary
+multibyte characters. A conversion specifier consists of a
+.B %
+character followed by a character that determines the behavior of the
+conversion specifier.
+All ordinary multibyte characters (including the terminating null
+character) are copied unchanged into the array.
+If copying takes place between objects that overlap the behavior is undefined.
+No more than
+.B maxsize
+characters are placed into the array.
+Each conversion specifier is replaced by appropriate characters as described
+in the following list.
+The appropriate characters are determined by the
+.B LC_TIME
+category of the current locale and by the values contained in the
+structure pointed to by
+.BR timeptr .
+.TP
+.B %a
+is replaced by the locale's abbreviated weekday name.
+.TP
+.B %A
+is replaced by the locale's full weekday name.
+.TP
+.B %b
+is replaced by the locale's abbreviated month name.
+.TP
+.B %B
+is replaced by the locale's full month name.
+.TP
+.B %c
+is replaced by the locale's appropriate date and time representation.
+.TP
+.B %d
+is replaced by the day of the month as a decimal number
+.RB ( 01 - 31 ).
+.TP
+.B %H
+is replaced by the hour (24-hour clock) as a decimal number
+.RB ( 00 - 23 ).
+.TP
+.B %I
+is replaced by the hour (12-hour clock) as a decimal number
+.RB ( 01 - 12 ).
+.TP
+.B %j
+is replaced by the day of the year as a decimal number
+.RB ( 001 - 366 ).
+.TP
+.B %m
+is replaced by the month as a decimal number
+.RB ( 01 - 12 ).
+.TP
+.B %M
+is replaced by the minute as a decimal number
+.RB ( 00 - 59 ).
+.TP
+.B %p
+is replaced by the locale's equivalent of the AM/PM designations associated
+with a 12-hour clock.
+.TP
+.B %S
+is replaced by the second as a decimal number
+.RB ( 00 - 61 ).
+.TP
+.B %U
+is replaced by the week number of the year (the first Sunday as the first
+day of week 1) as a decimal number
+.RB ( 00 - 53 ).
+.TP
+.B %w
+is replaced by the weekday as a decimal number
+.RB [ "0 " (Sunday)- 6 ].
+.TP
+.B %W
+is replaced by the week number of the year (the first Monday as the first
+day of week 1) as a decimal number
+.RB ( 00 - 53 ).
+.TP
+.B %x
+is replaced by the locale's appropriate date representation.
+.TP
+.B %X
+is replaced by the locale's appropriate time representation.
+.TP
+.B %y
+is replaced by the year without century as a decimal number
+.RB ( 00 - 99 ).
+.TP
+.B %Y
+is replaced by the year with century as a decimal number.
+.TP
+.B %Z
+is replaced by the time zone name or abbreviation, or by no characters if
+no time zone is determinable.
+.TP
+.B %%
+is replaced by
+.BR % .
+.LP
+If a conversion specifier is not one of the above, the behavior is
+undefined.
+.SH RETURNS
+If the total number of resulting characters including the terminating null
+character is not more than
+.BR maxsize ,
+the
+.B strftime
+function returns the number of characters placed into the array pointed to
+by
+.B s
+not including the terminating null character.
+Otherwise, zero is returned and the contents of the array are indeterminate.
+.SH NON-ANSI EXTENSIONS
+If
+.B SYSV_EXT
+is defined when the routine is compiled, then the following additional
+conversions will be available.
+These are borrowed from the System V
+.IR cftime (3)
+and
+.IR ascftime (3)
+routines.
+.TP
+.B %D
+is equivalent to specifying
+.BR %m/%d/%y .
+.TP
+.B %e
+is replaced by the day of the month,
+padded with a blank if it is only one digit.
+.TP
+.B %h
+is equivalent to
+.BR %b ,
+above.
+.TP
+.B %n
+is replaced with a newline character (\s-1ASCII LF\s+1).
+.TP
+.B %r
+is equivalent to specifying
+.BR "%I:%M:%S %p" .
+.TP
+.B %R
+is equivalent to specifying
+.BR %H:%M .
+.TP
+.B %T
+is equivalent to specifying
+.BR %H:%M:%S .
+.TP
+.B %t
+is replaced with a \s-1TAB\s+1 character.
+.SH POSIX 1003.2 EXTENSIONS
+If
+.B POSIX2_DATE
+is defined, then all of the conversions available with
+.B SYSV_EXT
+are available, as well as the
+following additional conversions:
+.TP
+.B %C
+The century, as a number between 00 and 99.
+.LP
+In additon, the alternate representations
+.BR %Ec ,
+.BR %EC ,
+.BR %Ex ,
+.BR %Ey ,
+.BR %EY ,
+.BR %Od ,
+.BR %Oe ,
+.BR %OH ,
+.BR %OI ,
+.BR %Om ,
+.BR %OM ,
+.BR %OS ,
+.BR %OU ,
+.BR %Ow ,
+.BR %OW ,
+and
+.B %Oy
+are recognized, but their normal representations are used.
+.SH VMS EXTENSIONS
+If
+.B VMS_EXT
+is defined, then the following additional conversion is available:
+.TP
+.B %V
+The date in VMS format (e.g. 20-JUN-1991).
+.SH SEE ALSO
+time(2), ctime(3), localtime(3)
+.SH BUGS
+This version does not handle multibyte characters or pay attention to the
+setting of the
+.B LC_TIME
+environment variable.
+.LP
+It is not clear what is ``appropriate'' for the C locale; the values
+returned are a best guess on the author's part.
+.SH CAVEATS
+This implementation calls
+.IR tzset (3)
+exactly once. If the
+.B TZ
+environment variable is changed after
+.B strftime
+has been called, then
+.IR tzset (3)
+must be called again, explicitly, in order for the
+correct timezone information to be available.
+.SH AUTHOR
+.nf
+Arnold Robbins
+AudioFAX, Inc.
+Suite 200
+2000 Powers Ferry Road
+Marietta, GA. 30067
+U.S.A.
+INTERNET: arnold@audiofax.com
+UUCP: emory!audfax!arnold
+Phone: +1 404 618 4281
+Fax-box: +1 404 618 4581
+.fi
+.SH ACKNOWLEDGEMENTS
+Thanks to Geoff Clare <gwc@root.co.uk> for helping debug earlier
+versions of this routine.
+Additional thanks to Arthur David Olsen <ado@elsie.nci.nih.gov>
+for some code improvements.
+