This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

bind time

Old posts that have not been replied to for several years.
Locked
E
Esoteric
Voice
Posts: 19
Joined: Mon Apr 11, 2005 1:08 pm

bind time

Post by Esoteric »

Can you make it so that with bind time that it executes every monday or tuesday or well you get the point.

-Erik
-Erik
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

No but you can bind to a specific time like 2am every day, then at the top of your proc put:

set day [lindex [split [clock format [clock seconds]]] 0]
if {$day != "Sun"} return

$day will be Sun, Mon, Tue, Wed, Thu, Fri, Sat so you can easily check to see if it's not the right day.
E
Esoteric
Voice
Posts: 19
Joined: Mon Apr 11, 2005 1:08 pm

Post by Esoteric »

perfect thanks
-Erik
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

stdragon wrote:set day [lindex [split [clock format [clock seconds]]] 0]
if {$day != "Sun"} return
if { [clock format [unixtime] -format %a] != "Sun" } { return }

sounds much shorter, easier and faster to me ^-^.
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...
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

strftime to the rescue

Code: Select all

if ![string match [strftime %a] "Sun"] return
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

[quote="De Kus"
if { [clock format [unixtime] -format %a] != "Sun" } { return }

sounds much shorter, easier and faster to me ^-^.[/quote]

Two things... first he said "monday or tuesday" so maybe he wants to expand it to be if {$day != "Mon" && $day != "Tue"} return, which I think is easier when you provide him with a nice little variable called $day. Second... shorter and faster... surely you're not trying to optimize a single line of code that takes less than 1/100000 of a second and only runs once a day!
Locked