[M3devel] checking of timezone in DateBsd.m3 vs. DatePosix.m3?

Jay K jay.krell at cornell.edu
Wed Apr 14 13:41:30 CEST 2010



Seems inconsistent:

 

 

DateBsd.m3:

 

 

IF (z = NIL) OR (z^ = Local^) THEN

tm := Utime.localtime(ADR(tv.tv_sec));

ELSIF z^ = UTC^ THEN

tm := Utime.gmtime(ADR(tv.tv_sec));

ELSE

(* unknown timezone *)

<* ASSERT FALSE *>

 

 

DatePosix.m3:

IF (z = NIL) OR (z^ = 0)

THEN EVAL Utime.localtime_r (tv.tv_sec, ADR (tm));

ELSE EVAL Utime.gmtime_r (tv.tv_sec, ADR(tm));

END;

 

 

DateBsd.m3 is the overwhelmingly used version, so presumably we should be like it.

 

 

readonly _DateImpls = {

"CYGWIN" : "DatePosix", (* hardly counts *)

"DARWIN" : "DateBsd",

"FREEBSD" : "DateBsd",

"HPUX" : "DatePosix", (* hardly counts *)

"INTERIX" : "DatePosix", (* hardly counts *)

"LINUX" : "DateBsd",

"NETBSD" : "DateBsd",

"NT" : "DatePosix", (* not actually used *)

"OPENBSD" : "DateBsd",

"SOLARIS" : "DatePosix", (* counts! *)

}

 

 

In both cases timezone is opaque but revealed to be a branded ref to an integer.

 

 

Of course, I'm going through this code again for purposes of porting to C, a) to remove struct tm, b) use http://code.google.com/p/y2038/ c) remove struct_timeval/gettimeofday.

 

 

- Jay
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100414/adde3637/attachment-0001.html>


More information about the M3devel mailing list