Code: Select all
bind time - "90 *" proc
are you sure ? either i'm drunk or this proc will never be triggerd.Sir_Fz wrote:this will trigger proc every 90 minutes.
Code: Select all
proc someproc {args} {
foreach i [timers] {
if {[lindex $i 1] == "someproc"} {
killtimer [lindex $i 2]
}
}
putlog "TRIGGERD ALL 90 MINS"
timer 90 someproc
}
timer 90 someproc
If I understand well, what you mean is that there can't be 90 mins in a clock (since 1 hour = 60mins) well if that's how bind time functions (because I don't exactly know how bind time functions) then my bind is wrong, else its correct.GodOfSuicide wrote:[snip]
bind time works with <minute> <hour> <day> <month> <year>
your bind would trigger every hour that has the minute value of 90...this aint gonna happen i'd say.
[snip]
bind time is for exact values.Sir_Fz wrote: If I understand well, what you mean is that there can't be 90 mins in a clock (since 1 hour = 60mins) well if that's how bind time functions
Code: Select all
# interval in minutes
# (you could of course hard code the interval value into the
# proc if you don't need it to be easy to spot and change :)
set interval 90
# this bind will trigger the proc every ten minutes
# (whenever the last digit of the minutes is "0")
bind time - ?0* timedThing
proc timedThing args {
# this calculation makes sure the code is only executed
# at the given interval
if {![expr {([clock sec]/60)%$::interval}]} {
# insert your code here
}
}
In what way? The code doing the check for an existing timer is much more cpu intensive than my time calculation and the eggdrop code dealing with timers / bind time is pretty much the same (iirc)GodOfSuicide wrote:user: i think the direct timer works a little better
the call for [timers] is only triggered when the actual proc is hit, it's used to avoid double timers when doing a rehash / whatever.user wrote:The code doing the check for an existing timer is much more cpu intensive than my time calculation
Code: Select all
bind time - "?0,?5 *" myProc
Code: Select all
bind time - "?0 *" myProc
bind time - "?5 *" myProc