[Jprogramming] datetime utc mod

bill lam bbill.lam at gmail.com
Wed Mar 26 00:48:44 UTC 2014


there should be some api in libc or windows dll to get utc time directly IIRC.

26.03.2014, в 2:30, Pascal Jasmin <godspiral2000 at yahoo.ca> написал(а):

> 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


More information about the Programming mailing list