diff options
author | deraadt <> | 1995-10-18 08:42:23 +0000 |
---|---|---|
committer | deraadt <> | 1995-10-18 08:42:23 +0000 |
commit | 0527d29da443886d92e9a418180c5b25a5f8d270 (patch) | |
tree | 86b3a64928451a669cefa27900e5884036b4e349 /src/lib/libc/string/strftime.3 | |
download | openbsd-0527d29da443886d92e9a418180c5b25a5f8d270.tar.gz openbsd-0527d29da443886d92e9a418180c5b25a5f8d270.tar.bz2 openbsd-0527d29da443886d92e9a418180c5b25a5f8d270.zip |
initial import of NetBSD tree
Diffstat (limited to 'src/lib/libc/string/strftime.3')
-rw-r--r-- | src/lib/libc/string/strftime.3 | 202 |
1 files changed, 202 insertions, 0 deletions
diff --git a/src/lib/libc/string/strftime.3 b/src/lib/libc/string/strftime.3 new file mode 100644 index 0000000000..f14db4bb13 --- /dev/null +++ b/src/lib/libc/string/strftime.3 | |||
@@ -0,0 +1,202 @@ | |||
1 | .\" Copyright (c) 1989, 1991 The Regents of the University of California. | ||
2 | .\" All rights reserved. | ||
3 | .\" | ||
4 | .\" This code is derived from software contributed to Berkeley by | ||
5 | .\" the American National Standards Committee X3, on Information | ||
6 | .\" Processing Systems. | ||
7 | .\" | ||
8 | .\" Redistribution and use in source and binary forms, with or without | ||
9 | .\" modification, are permitted provided that the following conditions | ||
10 | .\" are met: | ||
11 | .\" 1. Redistributions of source code must retain the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer. | ||
13 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
14 | .\" notice, this list of conditions and the following disclaimer in the | ||
15 | .\" documentation and/or other materials provided with the distribution. | ||
16 | .\" 3. All advertising materials mentioning features or use of this software | ||
17 | .\" must display the following acknowledgement: | ||
18 | .\" This product includes software developed by the University of | ||
19 | .\" California, Berkeley and its contributors. | ||
20 | .\" 4. Neither the name of the University nor the names of its contributors | ||
21 | .\" may be used to endorse or promote products derived from this software | ||
22 | .\" without specific prior written permission. | ||
23 | .\" | ||
24 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
25 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
26 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
28 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
30 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
31 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
32 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
34 | .\" SUCH DAMAGE. | ||
35 | .\" | ||
36 | .\" from: @(#)strftime.3 5.12 (Berkeley) 6/29/91 | ||
37 | .\" $Id: strftime.3,v 1.1.1.1 1995/10/18 08:42:22 deraadt Exp $ | ||
38 | .\" | ||
39 | .Dd June 29, 1991 | ||
40 | .Dt STRFTIME 3 | ||
41 | .Os | ||
42 | .Sh NAME | ||
43 | .Nm strftime | ||
44 | .Nd format date and time | ||
45 | .Sh SYNOPSIS | ||
46 | .Fd #include <time.h> | ||
47 | .Ft size_t | ||
48 | .Fn strftime "char *buf" "size_t maxsize" "const char *format" "const struct tm *timeptr" | ||
49 | .Sh DESCRIPTION | ||
50 | The | ||
51 | .Fn strftime | ||
52 | function formats the information from | ||
53 | .Fa timeptr | ||
54 | into the buffer | ||
55 | .Fa buf | ||
56 | according to the string pointed to by | ||
57 | .Fa format . | ||
58 | .Pp | ||
59 | The | ||
60 | .Fa format | ||
61 | string consists of zero or more conversion specifications and | ||
62 | ordinary characters. | ||
63 | All ordinary characters are copied directly into the buffer. | ||
64 | A conversion specification consists of a percent sign | ||
65 | .Ql % | ||
66 | and one other character. | ||
67 | .Pp | ||
68 | No more than | ||
69 | .Fa maxsize | ||
70 | characters will be placed into the array. | ||
71 | If the total number of resulting characters, including the terminating | ||
72 | null character, is not more than | ||
73 | .Fa maxsize , | ||
74 | .Fn strftime | ||
75 | returns the number of characters in the array, not counting the | ||
76 | terminating null. | ||
77 | Otherwise, zero is returned. | ||
78 | .Pp | ||
79 | Each conversion specification is replaced by the characters as | ||
80 | follows which are then copied into the buffer. | ||
81 | .Bl -tag -width "xxxx" | ||
82 | .It Cm \&%A | ||
83 | is replaced by the locale's full weekday name. | ||
84 | .It Cm %a | ||
85 | is replaced by the locale's abbreviated weekday name. | ||
86 | .It Cm \&%B | ||
87 | is replaced by the locale's full month name. | ||
88 | .It Cm \&%b No or Cm \&%h | ||
89 | is replaced by the locale's abbreviated month name. | ||
90 | .It Cm \&%C | ||
91 | is replaced by the century (a year divided by 100 and truncated to an integer) | ||
92 | as a decimal number (00-99). | ||
93 | .It Cm \&%c | ||
94 | is replaced by the locale's appropriate date and time representation. | ||
95 | .It Cm \&%D | ||
96 | is replaced by the date in the format | ||
97 | .Dq Li %m/%d/%y . | ||
98 | .It Cm \&%d | ||
99 | is replaced by the day of the month as a decimal number (01-31). | ||
100 | .It Cm \&%e | ||
101 | is replaced by the day of month as a decimal number (1-31); | ||
102 | single digits are preceded by a blank. | ||
103 | .It Cm \&%H | ||
104 | is replaced by the hour (24-hour clock) as a decimal number (00-23). | ||
105 | .It Cm \&%I | ||
106 | is replaced by the hour (12-hour clock) as a decimal number (01-12). | ||
107 | .It Cm \&%j | ||
108 | is replaced by the day of the year as a decimal number (001-366). | ||
109 | .It Cm \&%k | ||
110 | is replaced by the hour (24-hour clock) as a decimal number (0-23); | ||
111 | single digits are preceded by a blank. | ||
112 | .It Cm \&%l | ||
113 | is replaced by the hour (12-hour clock) as a decimal number (1-12); | ||
114 | single digits are preceded by a blank. | ||
115 | .It Cm \&%M | ||
116 | is replaced by the minute as a decimal number (00-59). | ||
117 | .It Cm %m | ||
118 | is replaced by the month as a decimal number (01-12). | ||
119 | .It Cm %n | ||
120 | is replaced by a newline. | ||
121 | .It Cm %p | ||
122 | is replaced by the locale's equivalent of either | ||
123 | .Dq Tn AM | ||
124 | or | ||
125 | .Dq Tn PM . | ||
126 | .It Cm \&%R | ||
127 | is replaced by the time in the format | ||
128 | .Dq Li %H:%M . | ||
129 | .It Cm \&%r | ||
130 | is replaced by the locale's representation of 12-hour clock time | ||
131 | using AM/PM notation. | ||
132 | .It Cm \&%T | ||
133 | is replaced by the time in the format | ||
134 | .Dq Li %H:%M:%S . | ||
135 | .It Cm \&%t | ||
136 | is replaced by a tab. | ||
137 | .It Cm \&%S | ||
138 | is replaced by the second as a decimal number (00-60). | ||
139 | .It Cm %s | ||
140 | is replaced by the number of seconds since the Epoch, UCT (see | ||
141 | .Xr mktime 3 ) . | ||
142 | .It Cm \&%U | ||
143 | is replaced by the week number of the year (Sunday as the first day of | ||
144 | the week) as a decimal number (00-53). | ||
145 | .It Cm \&%u | ||
146 | is replaced by the weekday (Monday as the first day of the week) | ||
147 | as a decimal number (1-7). | ||
148 | .It Cm \&%V | ||
149 | is replaced by the week number of the year (Monday as the first day of | ||
150 | the week) as a decimal number (01-53). If the week containing January | ||
151 | 1 has four or more days in the new year, then it is week 1; otherwise | ||
152 | it is week 53 of the previous year, and the next week is week 1. | ||
153 | .It Cm \&%W | ||
154 | is replaced by the week number of the year (Monday as the first day of | ||
155 | the week) as a decimal number (00-53). | ||
156 | .It Cm \&%w | ||
157 | is replaced by the weekday (Sunday as the first day of the week) | ||
158 | as a decimal number (0-6). | ||
159 | .It Cm \&%X | ||
160 | is replaced by the locale's appropriate date representation. | ||
161 | .It Cm \&%x | ||
162 | is replaced by the locale's appropriate time representation. | ||
163 | .It Cm \&%Y | ||
164 | is replaced by the year with century as a decimal number. | ||
165 | .It Cm \&%y | ||
166 | is replaced by the year without century as a decimal number (00-99). | ||
167 | .It Cm \&%Z | ||
168 | is replaced by the time zone name. | ||
169 | .It Cm %% | ||
170 | is replaced by | ||
171 | .Ql % . | ||
172 | .El | ||
173 | .Sh SEE ALSO | ||
174 | .Xr date 1 , | ||
175 | .Xr ctime 3 , | ||
176 | .Xr printf 1 , | ||
177 | .Xr printf 3 | ||
178 | .Sh STANDARDS | ||
179 | The | ||
180 | .Fn strftime | ||
181 | function | ||
182 | conforms to | ||
183 | .St -ansiC . | ||
184 | The | ||
185 | .Ql \&%C , | ||
186 | .Ql \&%D , | ||
187 | .Ql \&%e , | ||
188 | .Ql \&%h , | ||
189 | .Ql \&%k , | ||
190 | .Ql \&%l , | ||
191 | .Ql \&%n , | ||
192 | .Ql \&%r , | ||
193 | .Ql \&%R , | ||
194 | .Ql \&%s . | ||
195 | .Ql \&%t , | ||
196 | .Ql \&%T , | ||
197 | .Ql \&%u , | ||
198 | and | ||
199 | .Ql \&%V | ||
200 | conversion specifications are extensions. | ||
201 | .Sh BUGS | ||
202 | There is no conversion specification for the phase of the moon. | ||