mIRC Home    About    Download    Register    News    Help

Print Thread
$asctime daylight rules #264232 11/11/18 05:47 PM
Joined: Jan 2004
Posts: 1,198
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,198
While searching past threads about $timezone and $daylight and $asctime, I didn't find this issue addressed, so I'm checking to see if this is a bug or is a known item that won't be changed.

In 2007, USA changed the on/off rule for daylight saving time from April-through-October to March-through-November, and the new rule is being applied by $asctime(N) to the current year. However it is also applying the new rule to all past years, including the years 2006 and earlier which used the old rules.

This alias will be a little slow because it examines each hour of each day back to 1970 to identify when changing N by 3600 does not change the hour by +1 or -23.

Code:
alias dst_test2 {
  var %hr 00:00:00
  var %a $ctime($puttok($asctime($ctime),%hr,4,32))
  while (%a >= 0) {
    var %newtime $asctime(%a)
    dec %a 3600 | var %oldtime $asctime(%a)
    var %t1 $remove($gettok(%oldtime,4,32),:) , %t2 $remove($gettok(%newtime,4,32),:)
    var %diff $calc(%t2 - %t1)
    if ( !$istok(10000 -230000, %diff,32)) { echo -a from %oldtime to %newtime $base(%diff,10,10,5) }
  }
}

Re: $asctime daylight rules [Re: maroon] #264246 11/11/18 10:25 PM
Joined: Dec 2002
Posts: 4,563
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,563
mIRC uses Microsoft's time APIs/functions to perform all time-related calculations. The results you are seeing are those being returned by these APIs/functions. There are no plans to circumvent these by writing my own custom routines.