Is there a simple way to trigger an event at a certain time? Rightnow, I have been calculating the time till the event, and using thetimer. (See code below.) Unfortunately, the timer event is triggeredwhen \t is first set, so I need to keep some state to see whether it’sthe first trigger or the second. I was wondering if there was aneasier way.q)delay:0q).z.ts:{$[delay;[system “t 0”;delay::0;0N!x];delay::1]}q)system["t ",string 0N!`int$(`time$10+10 xbar `second$0N!.z.t)- .z.t];22:13:37.5882412q)2010.03.17D22:13:40.000967000Thanks,Victor
X-Mailer: Apple Mail (2.936)On Mar 17, 2010, at 6:16 PM, Victor Wong wrote:> Is there a simple way to trigger an event at a certain time? Right> now, I have been calculating the time till the event, and using the> timer. (See code below.) Unfortunately, the timer event is triggered> when \t is first set, so I need to keep some state to see whether it’s> the first trigger or the second. I was wondering if there was an> easier way.generally people write scheduler systems which maintain a global table of tasks to run at specific intervals or times, then use .z.ts (on a fairly tight schedule, e.g. 1 second) to check whether anything needs to be done at the moment.
Thanks, Aaron. That’s a good point. I was actually just trying to
start the timer so it ticks at the beginning of every minute, but I
think I have found a way to compensate for the jitter in the
calculation instead.