summaryrefslogtreecommitdiff
path: root/appl/lib
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2007-09-01 14:43:39 +0000
committerCharles.Forsyth <devnull@localhost>2007-09-01 14:43:39 +0000
commit4252603c74a95023984422e8cc3520cc3d9340ac (patch)
tree80b7d96db673b3f6d767e40ba1c92a346980fae6 /appl/lib
parent6fe7bebd2f2f6637660b1b20674622b1eeaf6180 (diff)
20070901-1541
Diffstat (limited to 'appl/lib')
-rw-r--r--appl/lib/daytime.b24
1 files changed, 20 insertions, 4 deletions
diff --git a/appl/lib/daytime.b b/appl/lib/daytime.b
index a650f8ca..0e16073b 100644
--- a/appl/lib/daytime.b
+++ b/appl/lib/daytime.b
@@ -341,10 +341,26 @@ string2tm(date: string): ref Tm
if(!ok)
return nil;
+ # optional time zone
+ while(date != nil && date[0] == ' ')
+ date = date[1:];
+ if(date != nil && !(date[0] >= '0' && date[0] <= '9')){
+ for(i := 0; i < len date; i++)
+ if(date[i] == ' '){
+ (tm.zone, tm.tzoff) = tzinfo(date[0: i]);
+ date = date[i:];
+ break;
+ }
+ }
+
# YY|YYYY
- (buf, tm.year) = datenum(date);
+ (nil, tm.year) = datenum(date);
if(tm.year > 1900)
tm.year -= 1900;
+ if(tm.zone == ""){
+ tm.zone = "GMT";
+ tm.tzoff = 0;
+ }
} else {
# Mon was not OK
date = odate;
@@ -364,10 +380,10 @@ string2tm(date: string): ref Tm
(ok, buf) = hhmmss(date, tm);
if(!ok)
return nil;
+ (tm.zone, tm.tzoff) = tzinfo(buf);
+ if(tm.zone == "")
+ return nil;
}
- (tm.zone, tm.tzoff) = tzinfo(buf);
- if(tm.zone == "")
- return nil;
return tm;
}