mIRC Homepage

$asctime daylight rules

Posted By: maroon

$asctime daylight rules - 11/11/18 05:47 PM

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.

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) }
Posted By: Khaled

Re: $asctime daylight rules - 11/11/18 10:25 PM

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.
© 2019 mIRC Discussion Forums