| @@ -1,6 +1,6 @@ |
| 1 | .TH DAYTIME 2 | 1 | .TH DAYTIME 2 |
| 2 | .SH NAME | 2 | .SH NAME |
| 3 | daytime: text, filet, gmt, local, now, time, tm2epoch \- time conversions | 3 | daytime: text, filet, gmt, local, now, string2tm, time, tm2epoch \- time conversions |
| 4 | .SH SYNOPSIS | 4 | .SH SYNOPSIS |
| 5 | .EX | 5 | .EX |
| 6 | include "daytime.m"; | 6 | include "daytime.m"; |
| @@ -20,13 +20,14 @@ Tm: adt · 13 unmodified lines |
| 20 | tzoff: int; # time zone offset (seconds from GMT) | 20 | tzoff: int; # time zone offset (seconds from GMT) |
| 21 | }; | 21 | }; |
| 22 | | 22 | |
| 23 | text: fn(tm: ref Tm): string; | 23 | text: fn(tm: ref Tm): string; |
| 24 | filet: fn(now, t: int): string; | 24 | filet: fn(now, t: int): string; |
| 25 | gmt: fn(tim: int): ref Tm; | 25 | gmt: fn(tim: int): ref Tm; |
| 26 | local: fn(tim: int): ref Tm; | 26 | local: fn(tim: int): ref Tm; |
| 27 | now: fn(): int; | 27 | now: fn(): int; |
| 28 | time: fn(): string; | 28 | time: fn(): string; |
| 29 | tm2epoch: fn(tm: ref Tm): int; | 29 | tm2epoch: fn(tm: ref Tm): int; |
| | 30 | string2tm: fn(date: string): ref Tm; |
| 30 | .EE | 31 | .EE |
| 31 | .SH DESCRIPTION | 32 | .SH DESCRIPTION |
| 32 | These routines perform time conversions relative to the | 33 | These routines perform time conversions relative to the |
| @@ -42,7 +43,7 @@ converts a time structure referenced by · 9 unmodified lines |
| 42 | .I tm | 43 | .I tm |
| 43 | from local or GMT time to a string in the format: | 44 | from local or GMT time to a string in the format: |
| 44 | .IP | 45 | .IP |
| 45 | .BR "Sat Jan 1 13:00:00 GMT 2000" . | 46 | .B "Sat Jan 1 13:00:00 GMT 2000" |
| 46 | .PP | 47 | .PP |
| 47 | .B Filet | 48 | .B Filet |
| 48 | converts the file access or modification time | 49 | converts the file access or modification time |
| @@ -70,12 +71,10 @@ converts seconds since the epoch, received in · 21 unmodified lines |
| 70 | to a time structure in local time. | 71 | to a time structure in local time. |
| 71 | .PP | 72 | .PP |
| 72 | .B Now | 73 | .B Now |
| 73 | returns the time in seconds since the epoch, which | 74 | returns the time in seconds since the epoch, obtained by reading |
| 74 | it obtains by reading | | |
| 75 | .B /dev/time | 75 | .B /dev/time |
| 76 | (see | 76 | (see |
| 77 | .IR cons (3)) | 77 | .IR cons (3)). |
| 78 | to get the time in microseconds since the epoch. | | |
| 79 | .PP | 78 | .PP |
| 80 | .B Time | 79 | .B Time |
| 81 | converts seconds since the epoch | 80 | converts seconds since the epoch |
| @@ -86,6 +85,26 @@ to the local time as a string in the format · 4 unmodified lines |
| 86 | converts a time structure referenced by | 85 | converts a time structure referenced by |
| 87 | .I tm | 86 | .I tm |
| 88 | from local or GMT time to seconds since the epoch. | 87 | from local or GMT time to seconds since the epoch. |
| | 88 | .PP |
| | 89 | .B String2tm |
| | 90 | returns a reference to a |
| | 91 | .B Tm |
| | 92 | value corresponding to the date and time in textual form in string |
| | 93 | .IR s , |
| | 94 | which must have one of the forms below: |
| | 95 | .IP |
| | 96 | .EX |
| | 97 | Sun, 06 Nov 1994 08:49:37 GMT \fR(RFC822, RFC1123)\fP |
| | 98 | Sunday, 06-Nov-94 08:49:37 GMT \fR(RFC850)\fP |
| | 99 | Sun Nov 6 08:49:37 GMT 1994 \fR(output of \fPtext\fR, above)\fP |
| | 100 | .EE |
| | 101 | .PP |
| | 102 | A missing time zone in any format is assumed to be |
| | 103 | .BR GMT . |
| | 104 | .B String2tm |
| | 105 | returns nil if |
| | 106 | .I s |
| | 107 | is not correctly formed. |
| 89 | .SH SOURCE | 108 | .SH SOURCE |
| 90 | .B /appl/lib/daytime.b | 109 | .B /appl/lib/daytime.b |
| 91 | .SH SEE ALSO | 110 | .SH SEE ALSO |