| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | .\" $NetBSD: ctime.3,v 1.32 2010/05/15 13:54:52 pgoyette Exp $ | | 1 | .\" $NetBSD: ctime.3,v 1.33 2010/10/27 19:16:04 christos Exp $ |
2 | .Dd February 2, 2010 | | 2 | .Dd October 27, 2010 |
3 | .Dt CTIME 3 | | 3 | .Dt CTIME 3 |
4 | .Os | | 4 | .Os |
5 | .Sh NAME | | 5 | .Sh NAME |
6 | .Nm asctime , | | 6 | .Nm asctime , |
7 | .Nm asctime_r , | | 7 | .Nm asctime_r , |
8 | .Nm ctime , | | 8 | .Nm ctime , |
9 | .Nm ctime_r , | | 9 | .Nm ctime_r , |
10 | .Nm difftime , | | 10 | .Nm difftime , |
11 | .Nm gmtime , | | 11 | .Nm gmtime , |
12 | .Nm gmtime_r , | | 12 | .Nm gmtime_r , |
13 | .Nm localtime , | | 13 | .Nm localtime , |
14 | .Nm localtime_r , | | 14 | .Nm localtime_r , |
15 | .Nm mktime | | 15 | .Nm mktime |
| @@ -31,42 +31,52 @@ | | | @@ -31,42 +31,52 @@ |
31 | .Fn asctime_r "const struct tm restrict tm" "char * restrict buf" | | 31 | .Fn asctime_r "const struct tm restrict tm" "char * restrict buf" |
32 | .Ft struct tm * | | 32 | .Ft struct tm * |
33 | .Fn localtime "const time_t *clock" | | 33 | .Fn localtime "const time_t *clock" |
34 | .Ft struct tm * | | 34 | .Ft struct tm * |
35 | .Fn localtime_r "const time_t * restrict clock" "struct tm * restrict result" | | 35 | .Fn localtime_r "const time_t * restrict clock" "struct tm * restrict result" |
36 | .Ft struct tm * | | 36 | .Ft struct tm * |
37 | .Fn gmtime "const time_t *clock" | | 37 | .Fn gmtime "const time_t *clock" |
38 | .Ft struct tm * | | 38 | .Ft struct tm * |
39 | .Fn gmtime_r "const time_t * restrict clock" "struct tm * restrict result" | | 39 | .Fn gmtime_r "const time_t * restrict clock" "struct tm * restrict result" |
40 | .Ft time_t | | 40 | .Ft time_t |
41 | .Fn mktime "struct tm *tm" | | 41 | .Fn mktime "struct tm *tm" |
42 | .Sh DESCRIPTION | | 42 | .Sh DESCRIPTION |
43 | .Fn ctime | | 43 | .Fn ctime |
44 | converts a long integer, pointed to by | | 44 | converts a |
| | | 45 | .Tp time_t , |
| | | 46 | pointed to by |
45 | .Fa clock , | | 47 | .Fa clock , |
46 | representing the time in seconds since | | 48 | representing the time in seconds since |
47 | 00:00:00 UTC, 1970-01-01, | | 49 | 00:00:00 UTC, 1970-01-01, |
48 | and returns a pointer to a | | 50 | and returns a pointer to a |
49 | string of the form | | 51 | string of the form |
50 | .D1 Thu Nov 24 18:22:48 1986\en\e0 | | 52 | .D1 Thu Nov 24 18:22:48 1986\en\e0 |
51 | Years requiring fewer than four characters are padded with leading zeroes. | | 53 | Years requiring fewer than four characters are padded with leading zeroes. |
52 | For years longer than four characters, the string is of the form | | 54 | For years longer than four characters, the string is of the form |
53 | .D1 Thu Nov 24 18:22:48 81986\en\e0 | | 55 | .D1 Thu Nov 24 18:22:48 81986\en\e0 |
54 | with five spaces before the year. | | 56 | with five spaces before the year. |
55 | These unusual formats are designed to make it less likely that older | | 57 | These unusual formats are designed to make it less likely that older |
56 | software that expects exactly 26 bytes of output will mistakenly output | | 58 | software that expects exactly 26 bytes of output will mistakenly output |
57 | misleading values for out-of-range years. | | 59 | misleading values for out-of-range years. |
58 | .Pp | | 60 | .Pp |
59 | .Fn Localtime | | 61 | .Fn ctime_r |
| | | 62 | is similar to |
| | | 63 | .Fn ctime , |
| | | 64 | except it places the result of the convertion on the |
| | | 65 | .Fa buf |
| | | 66 | argument which should be 26 or more bytes long, instead of using a global |
| | | 67 | static buffer. |
| | | 68 | .Pp |
| | | 69 | .Fn localtime |
60 | and | | 70 | and |
61 | .Fn gmtime | | 71 | .Fn gmtime |
62 | return pointers to | | 72 | return pointers to |
63 | .Va tm | | 73 | .Va tm |
64 | structures, described below. | | 74 | structures, described below. |
65 | .Fn localtime | | 75 | .Fn localtime |
66 | corrects for the time zone and any time zone adjustments | | 76 | corrects for the time zone and any time zone adjustments |
67 | (such as Daylight Saving Time in the U.S.A.). | | 77 | (such as Daylight Saving Time in the U.S.A.). |
68 | After filling in the | | 78 | After filling in the |
69 | .Va tm | | 79 | .Va tm |
70 | structure, | | 80 | structure, |
71 | .Fn localtime | | 81 | .Fn localtime |
72 | sets the | | 82 | sets the |
| @@ -89,27 +99,28 @@ functions provide the same functionality | | | @@ -89,27 +99,28 @@ functions provide the same functionality |
89 | .Fn gmtime | | 99 | .Fn gmtime |
90 | and | | 100 | and |
91 | .Fn localtime | | 101 | .Fn localtime |
92 | differing in that the caller must supply a buffer area | | 102 | differing in that the caller must supply a buffer area |
93 | .Fa result | | 103 | .Fa result |
94 | in which the result is stored; also, | | 104 | in which the result is stored; also, |
95 | .Fn localtime_r | | 105 | .Fn localtime_r |
96 | does not imply initialization of the local time conversion information; | | 106 | does not imply initialization of the local time conversion information; |
97 | the application may need to do so by calling | | 107 | the application may need to do so by calling |
98 | .Xr tzset 3 . | | 108 | .Xr tzset 3 . |
99 | .Pp | | 109 | .Pp |
100 | .Fn asctime | | 110 | .Fn asctime |
101 | converts a time value contained in a | | 111 | converts a time value contained in a |
102 | ``tm'' structure to a string, | | 112 | .Dq tm |
| | | 113 | structure to a string, |
103 | as shown in the above example, | | 114 | as shown in the above example, |
104 | and returns a pointer to the string. | | 115 | and returns a pointer to the string. |
105 | .Pp | | 116 | .Pp |
106 | .Fn mktime | | 117 | .Fn mktime |
107 | converts the broken-down time, | | 118 | converts the broken-down time, |
108 | expressed as local time, | | 119 | expressed as local time, |
109 | in the structure pointed to by | | 120 | in the structure pointed to by |
110 | .Fa tm | | 121 | .Fa tm |
111 | into a calendar time value with the same encoding as that of the values | | 122 | into a calendar time value with the same encoding as that of the values |
112 | returned by the | | 123 | returned by the |
113 | .Xr time 3 | | 124 | .Xr time 3 |
114 | function. | | 125 | function. |
115 | The original values of the | | 126 | The original values of the |