A negative delay put aside,I never got the d-switch working for that.
E.g.:
//.timer -d 1 0 echo -a 1 | .timer -d 1 0 echo -a 2 | .timer -d 1 0 echo -a 3
sometimes resulted in "1 2 3" but most times in "2 1 3" on my machine...
I thus did:
; /timertest [h|d]
alias timertest {
var %a = 1, %b = 1, %s = $left($1,1)
echo -ag * starting 8 timers (4x 0s, 4x 1s) with $iif((%s isin hd),the $v1,no) switch...
while (%a <= 4) {
.timer $iif((%s isin hd),- $+ $v1) 1 0 echo -ag delay 0 : $ord(%a)
inc %a
}
while (%b <= 4) {
.timer $iif((%s isin hd),- $+ $v1) 1 $iif((%s == h),1000,1) echo -ag delay 1 : $ord(%b)
inc %b
}
}/timertest
* starting 8 timers (4x 0s, 4x 1s) with no switch...
delay 0 : 4th
delay 0 : 3rd
delay 0 : 2nd
delay 0 : 1st
delay 1 : 1st
delay 1 : 2nd
delay 1 : 3rd
delay 1 : 4th
/timertest d
* starting 8 timers (4x 0s, 4x 1s) with the d switch...
delay 0 : 4th
delay 0 : 3rd
delay 0 : 2nd
delay 0 : 1st
delay 1 : 1st
delay 1 : 2nd
delay 1 : 3rd
delay 1 : 4th
/timertest h
* starting 8 timers (4x 0s, 4x 1s) with the h switch...
delay 0 : 1st
delay 0 : 2nd
delay 0 : 3rd
delay 0 : 4th
delay 1 : 1st
delay 1 : 2nd
delay 1 : 3rd
delay 1 : 4th
Now I wonder what -d is made for... I tested as well with
named timers and/or timers that will fire at a certain [time] value...
alias timertest2 {
var %s = $iif(($1 == d),-d), %t = $asctime($calc($ctime +60),HH:nn)
echo -ag * starting 6 timers $iif(%s,with the $v1 switch) (3 fire at %t $+ :00, 3 fire at %t $+ :01)...
.timerB %s %t 1 0 echo -ag 1st
.timerA %s %t 1 0 echo -ag 2nd
.timerC %s %t 1 0 echo -ag 3rd
.timerZ %s %t 1 1 echo -ag 1st
.timerX %s %t 1 1 echo -ag 2nd
.timerY %s %t 1 1 echo -ag 3rd
}/timertest2
* starting 6 timers (3 fire at 17:10:00, 3 fire at 17:10:01)...
3rd
2nd
1st
2nd
3rd
1st
/timertest2 d
* starting 6 timers with the -d switch (3 fire at 17:11:00, 3 fire at 17:11:01)...
3rd
2nd
1st
2nd
3rd
1st
Edit: the -d switch is taken into account in the
list of timers (/timer). I don't see any effect beyond that though.