mIRC Home    About    Download    Register    News    Help

Topic Options
#264232 - 11/11/18 05:47 PM $asctime daylight rules
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 969
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) }
  }
}

Top
#264246 - 11/11/18 10:25 PM Re: $asctime daylight rules [Re: maroon]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4295
Loc: London, UK
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.

Top