| View previous topic :: View next topic |
| Author |
Message |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Tue Feb 16, 2016 10:26 am Post subject: Subtract seconds (math) [Help] |
|
|
In the file "djhora" I have stored the time value "count4d" .
What I want is to recover this value and subtract it to the current time .
If the result is equal to 180 seconds then execute a command.
| Code: |
.....more commands.....
if {![file exists djhora]} {
set count4d [clock seconds]
set temp [open "djhora" w+]
puts $temp "$count4d"
close $temp
}
set temp [open "djhora" r]
set djh [gets $temp]
close $temp
if {[expr {[clock seconds] - $djh}] == 180} { do more commands..... }
|
What is wrong ? _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Wed Feb 17, 2016 9:04 am Post subject: Re: Subtract seconds (math) [Help] |
|
|
Are you sure you want to use == ?
Whatever you are doing, won't it be difficult to hit it exactly on 180 seconds?
Perhaps you want >= or <= ? _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Wed Feb 17, 2016 10:32 am Post subject: Re: Subtract seconds (math) [Help] |
|
|
Thanks willyw, work fine!  _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
|