Here are additions I've made to datetime.ijs (addons/type)
utcnow_z_ '' returns utc time tested on mac and windows.
a question about 6!:0 ... when DST changes, will it report the changes without
reloading J? Some OS change the time automatically, while others ask to change
clock, or do they all ask?
Now_z_ =: 6!:0@:(''"_)
utcBIAS_z_ =: 3 : 0 '' NB. may bug on unix if loaded at turn of month/year, so
redo. Must reload on DST change
if. IFWIN do. 0,~ >1{ getTimeZoneInfo_rgsdatetime_ ''
elseif. IFIOS do. 0
elseif. 1 do. t=. +/ 3600 60 1 * (2 3 4{6!:0'') -~ (0&".@:>@:(1&{),~
".@:>@:{:@:;:@:>@:{.) ':' cut 2!:0 'date -u'
if. 0=15|t do. t, 0 else. 0 ,~ +/ 3600 60 1 * (2 3 4{6!:0'') -~
(0&".@:>@:(1&{),~ ".@:>@:{:@:;:@:>@:{.) ':' cut 2!:0 'date -u' end. end.
)
utc_z_ =: tsPlus&utcBIAS
utcnow_z_ =: utc@:Now ''"_
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm