| View previous topic :: View next topic |
| Author |
Message |
honeybee Halfop
Joined: 01 Jan 2006 Posts: 80
|
Posted: Fri May 12, 2006 9:41 am Post subject: is it correct? |
|
|
I'm trying to make a time check bind to hit routine:check proc after every 3 hours. i guess its not the correct way, btw. with current version of tcl we can directly do it instead of making bind for everyhour and checking inside the proc?
bind time - "*0 * * * *" routine:check
bind time - "* */3 * * *" routine:check |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri May 12, 2006 11:14 am Post subject: |
|
|
| Code: | bind time - "00 *" routine:check
proc routine:check {m h args} {
if {[scan $h %d]%3 != 0} {return 0}
# do your stuff here
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
honeybee Halfop
Joined: 01 Jan 2006 Posts: 80
|
Posted: Fri May 12, 2006 1:25 pm Post subject: |
|
|
Thanks, i was thinking to use.
| Code: | | if {[expr $hour % 3]} { return } |
|
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Fri May 12, 2006 6:32 pm Post subject: |
|
|
which basicly does the same, since the expression will return doing nothing, if the reminder is not 0... _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Fri May 12, 2006 7:02 pm Post subject: |
|
|
Yes, but the number needs to be converted to decimal because 08 and 09 are not valid octal numbers. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Sat May 13, 2006 1:42 pm Post subject: |
|
|
oh, I didnt preconceive that. You are totally right. I wondered why you used scan to get the integer . Alternately you could simply use [string trimleft $h 0] . I'd guess it would be faster.
| Quote: | StarZ|De_Kus ?calc 08 % 3
-[-RO^Bot-]- Fehler: expected integer but got "08" (looks like invalid octal number) |
_________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
|