I'd like to be able to send a message via the bot based on the time of day to a user or channel...basically what I have is a customer service bot that assumes oper status on an IRC server and I need it to send a message to customers that join the server and tell them that customer service is "closed" between certain times.
# get the number of seconds since midnight...
set timeOfDay [expr {[clock seconds]%86400}]
# now, just convert your opening/closing times to seconds past midnight and compare them to that value
if {$timeOfDay>=$open && $timeOfDay<$close} {you're supposed to be avaliable :P}
set open [expr {[clock scan "9 am"]%86400}]
set close [expr {[clock scan "16:00"]%86400}]
...or you could of course just multiply the decimal hour (0.00-23.98 ) with 3600 to save some cpu. But these calculations should be done only once (when the times are set/changed) and the result should be kept in global variables. (imo)
I did the 'clock scan' examples in 12/24 hour formats just to give you an idea of what kind of input clock scan will accept.
Check http://tcl.tk/man/tcl8.4/TclCmd/clock.htm#M43 if you need some more info on this.