| View previous topic :: View next topic |
| Author |
Message |
intel Halfop
Joined: 26 Feb 2008 Posts: 57
|
Posted: Fri Dec 19, 2008 3:02 pm Post subject: Check Pretime |
|
|
I am trying to get my script to announce BACKFiLL if the pretime is older then 12hrs.
Any help is appreciated.
Last edited by intel on Wed Dec 24, 2008 10:02 am; edited 1 time in total |
|
| Back to top |
|
 |
x-treem Voice
Joined: 21 Jul 2008 Posts: 9
|
Posted: Fri Dec 19, 2008 6:58 pm Post subject: |
|
|
| you sure have something that will call a duration function, somewhere there you should have a difference betwen now and pretime that is the variable you look for (or create one if that is not set to a variable). If that is >12h (3600 * 12) or whatever you like, then BACKFILL |
|
| Back to top |
|
 |
intel Halfop
Joined: 26 Feb 2008 Posts: 57
|
Posted: Fri Dec 19, 2008 11:56 pm Post subject: |
|
|
I have
set time1 [unixtime]
incr time1 -$timestamp
set ago [duration $time1]
set after [clock clicks -milliseconds]
so I am confused as to what I should be doing and why 3600 *12? |
|
| Back to top |
|
 |
ShavdApe Halfop
Joined: 15 Dec 2003 Posts: 46
|
Posted: Mon Dec 22, 2008 1:11 pm Post subject: |
|
|
ideally you want time in seconds of your pretime
Now im not sure what your $timestamp looks like if its just unixtime but at the time of the pre then
set ago [expr $timestamp -[unixtime]] is all you need and youll be left with the amount of seconds between those two times.
if timestamp is more like a date format then use [clock scan $timestamp]
now youll need a limit set in seconds and then simply your if statement would look something like
set limit 3600
if {$ago > $limit} {
putqucik "PRIVMSG $chan :\[BACKFiLL] -- $rls was pred $ago ago
}
note 3600 = 1 hour in seconds hence the 12 * 3600 comment above i think
I think thats all correct anyway someone im sure will correct me if im wrong.
*edit*
ah looking at the above again it appears your $ago is more like 1 hour 30 secs ill assume your duration process does that if thats the case youll need to do that after the if cos the above code would work in seconds only. Hope this all helps not something I usually do this helping people business cos I suck at it lol _________________ Driving lessons bolton |
|
| Back to top |
|
 |
|