History

20070901-1541

Charles.Forsyth committed 19 years ago

Commit de2f8de1 parent b2446075 files · +54 −16Browse files

Unified · Split

5 files
  1. CHANGES +2 −0
  2. appl/lib/daytime.b +20 −4
  3. dis/lib/daytime.dis +0 −0
  4. man/2/INDEX +1 −0
  5. man/2/daytime +32 −13
CHANGES+2−0
@@ -1,3 +1,5 @@
120070902
2 make /appl/lib/daytime.b accept Daytime->text's output; add string2tm to man page (issue 59)
120070901320070901
2 add andrey's changes to emu/MacOSX/win.c (used by emu/MacOSX/mkfile-a)4 add andrey's changes to emu/MacOSX/win.c (used by emu/MacOSX/mkfile-a)
3 add saoret's changes to dis/lookman, dis/man (issue 58)5 add saoret's changes to dis/lookman, dis/man (issue 58)
appl/lib/daytime.b+20−4
@@ -341,10 +341,26 @@ string2tm(date: string): ref Tm · 340 unmodified lines
341 if(!ok)341 if(!ok)
342 return nil;342 return nil;
343 343
344 # optional time zone
345 while(date != nil && date[0] == ' ')
346 date = date[1:];
347 if(date != nil && !(date[0] >= '0' && date[0] <= '9')){
348 for(i := 0; i < len date; i++)
349 if(date[i] == ' '){
350 (tm.zone, tm.tzoff) = tzinfo(date[0: i]);
351 date = date[i:];
352 break;
353 }
354 }
355
344 # YY|YYYY356 # YY|YYYY
345 (buf, tm.year) = datenum(date);357 (nil, tm.year) = datenum(date);
346 if(tm.year > 1900)358 if(tm.year > 1900)
347 tm.year -= 1900;359 tm.year -= 1900;
360 if(tm.zone == ""){
361 tm.zone = "GMT";
362 tm.tzoff = 0;
363 }
348 } else {364 } else {
349 # Mon was not OK365 # Mon was not OK
350 date = odate;366 date = odate;
@@ -364,10 +380,10 @@ string2tm(date: string): ref Tm · 13 unmodified lines
364 (ok, buf) = hhmmss(date, tm);380 (ok, buf) = hhmmss(date, tm);
365 if(!ok)381 if(!ok)
366 return nil;382 return nil;
383 (tm.zone, tm.tzoff) = tzinfo(buf);
384 if(tm.zone == "")
385 return nil;
367 }386 }
368 (tm.zone, tm.tzoff) = tzinfo(buf);
369 if(tm.zone == "")
370 return nil;
371 387
372 return tm;388 return tm;
373}389}
dis/lib/daytime.dis+0−0

Binary file not shown.

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