]>
Commit | Line | Data |
---|---|---|
1 | --- strptime.3.orig 2007-04-03 12:19:24.000000000 -0700 | |
2 | +++ strptime.3 2007-04-03 12:54:12.000000000 -0700 | |
3 | @@ -29,7 +29,8 @@ | |
4 | .Dt STRPTIME 3 | |
5 | .Os | |
6 | .Sh NAME | |
7 | -.Nm strptime | |
8 | +.Nm strptime , | |
9 | +.Nm strptime_l | |
10 | .Nd parse date and time string | |
11 | .Sh LIBRARY | |
12 | .Lb libc | |
13 | @@ -37,19 +38,28 @@ | |
14 | .In time.h | |
15 | .Ft char * | |
16 | .Fo strptime | |
17 | -.Fa "const char * restrict buf" | |
18 | -.Fa "const char * restrict format" | |
19 | -.Fa "struct tm * restrict timeptr" | |
20 | +.Fa "const char *restrict buf" | |
21 | +.Fa "const char *restrict format" | |
22 | +.Fa "struct tm *restrict tm" | |
23 | +.Fc | |
24 | +.In time.h | |
25 | +.In xlocale.h | |
26 | +.Ft char * | |
27 | +.Fo strptime_l | |
28 | +.Fa "const char *restrict buf" | |
29 | +.Fa "const char *restrict format" | |
30 | +.Fa "struct tm *restrict tm" | |
31 | +.Fa "locale_t loc" | |
32 | .Fc | |
33 | .Sh DESCRIPTION | |
34 | The | |
35 | .Fn strptime | |
36 | function parses the string in the buffer | |
37 | -.Fa buf | |
38 | +.Fa buf , | |
39 | according to the string pointed to by | |
40 | .Fa format , | |
41 | and fills in the elements of the structure pointed to by | |
42 | -.Fa timeptr . | |
43 | +.Fa tm . | |
44 | The resulting values will be relative to the local time zone. | |
45 | Thus, it can be considered the reverse operation of | |
46 | .Xr strftime 3 . | |
47 | @@ -78,7 +88,7 @@ | |
48 | specify the resulting | |
49 | .Vt struct tm , | |
50 | the unspecified members of | |
51 | -.Va timeptr | |
52 | +.Va tm | |
53 | are left untouched. | |
54 | For example, if | |
55 | .Fa format | |
56 | @@ -91,9 +101,17 @@ | |
57 | .Va tm_min | |
58 | will be modified. | |
59 | If time relative to today is desired, initialize the | |
60 | -.Fa timeptr | |
61 | +.Fa tm | |
62 | structure with today's date before passing it to | |
63 | .Fn strptime . | |
64 | +.Pp | |
65 | +While the | |
66 | +.Fn strptime | |
67 | +function uses the current locale, the | |
68 | +.Fn strptime_l | |
69 | +function may be passed a locale directly. See | |
70 | +.Xr xlocale 3 | |
71 | +for more information. | |
72 | .Sh RETURN VALUES | |
73 | Upon successful completion, | |
74 | .Fn strptime | |
75 | @@ -104,10 +122,16 @@ | |
76 | It returns | |
77 | .Dv NULL | |
78 | if one of the conversions failed. | |
79 | +.Sh LEGACY DESCRIPTION | |
80 | +In legacy mode, the | |
81 | +.Fa %Y | |
82 | +format specifier expects exactly 4 digits (leaving any trailing digits for the | |
83 | +next specifier). | |
84 | .Sh SEE ALSO | |
85 | .Xr date 1 , | |
86 | .Xr scanf 3 , | |
87 | -.Xr strftime 3 | |
88 | +.Xr strftime 3 , | |
89 | +.Xr xlocale 3 | |
90 | .Sh AUTHORS | |
91 | The | |
92 | .Fn strptime |