So I wrote this script to perform what should be the simple task of triggering a timer every minute, hour and midnight. Also threw in every 15 minutes and half-hour. It does this very well but it's more convoluted than I would hope, and that's because it needs to take in two very rare occurrences into consideration -- daylight savings time change, and system clock adjustments.

The events will always fire at the exact clock event when the second changes over, unless the system is busy due to high CPU load. By this, I mean it triggers at the exact roll-over or first interrupt of the 64 or 100 interrupts there are per second. So this can be very handy for interacting with logged events -- ie, it will trigger at midnight before any other messages arrive at midnight.

Code:
; heartbeat

On *:START: {
  ; Create debug window.
  window -aDeizj10000 @heartbeat
  ; Begin heartbeat.
  heartbeat
}

ALIAS heartbeat { ; by Raccoon 2015
  ; Set $1- to SEC MIN HOUR DAY MONTH YEAR
  tokenize 32 $asctime(ss nn HH dd mm yyyy)

  ; Assurance timer keeps checking in case of daylight saving time change or clock adjustment.
  ; Why 9 seconds?  00, 09, 18, 27, 36, 45, 54, [60], 63.
  .timerheartbeat -oi 0 9 heartbeat

  ; On-The-Minute timer triggers at exactly next 00 seconds. Never 59. Rarely 01 if super lagged.
  ; "$asctime($calc($ctime + 60ish)" will return correctly for daylight savings time change.
  .timer_heartbeat -oi $asctime($calc($ctime + (69 - $1)),HH:nn) 1 0 heartbeat

  ; Do not continue unless minute has changed.
  if (%heartbeat.last == $2-) { return }
  set -u90 %heartbeat.last $2-

  ; Trigger events for current time.
  if ($2-3 == 00 00)       .signal everyday $1-
  if ($2 == 00)            .signal everyhour $1-
  if ($calc($2 % 30) == 0) .signal everythirty $1-  
  if ($calc($2 % 15) == 0) .signal everyfifteen $1-
  .signal everyminute $1-

  ; Debug output.
  if ($window(@heartbeat)) { echo $v1 HEARTBEAT $1- : $right($ticks,3) }
}

On *:SIGNAL:everyminute: {
  ; things to do every minute.

}

On *:SIGNAL:everyfifteen: {
  ; things to do every quarter hour.

}

On *:SIGNAL:everythirty: {
  ; things to do every half hour.

}

On *:SIGNAL:everyhour: {
  ; things to do every hour.

}

On *:SIGNAL:everyday: {
  ; things to do at midnight.
  scon -a echo -stic notify * Day changed to $asctime(dd mmm yyyy) $+ , a $asctime(dddd) $+ .
}


It would be great if all this code could be reduced to a simple timer with parameters, but I can't imagine how, while retaining the ability to detect small adjustments to the system clock or the time changing 1 or 2 hours forward or backward for daylight savings, or timezone changes on laptops.