Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time calculation.

Status
Not open for further replies.

bebig

Technical User
Oct 21, 2004
111
US
I just started from yesterday..very new..
I am trying to calculate "TIME"
I have this problem.

error says " no script following if {$endTimeMin >= 60}"

would you please tell me why it is wrong?
Thank you in advance

---code--

set runTime 150

set b 13:30
set b1 [split $b :]
set b3 [lindex $b1 0]
set b4 [lindex $b1 1]

set runTimeMin [expr int(fmod($runTime,60))]
set runTimeHour [expr int($runTime/60)]

set endTimeHour [expr {$b3+$runTimeHour}]
set endTimeMin [expr {$b4+$runTimeMin}]

#set result3 "$endTimeHour:$endTimeMin"

if {$endTimeMin >= 60}
{
set minFormat [expr int(fmod($endTimeMin,60))]
set hourFormat [expr ($endTimeHour + 1)]

puts "$hourFormat:$minFormat"

#if hourFormat is over 25, 26, 27

if {$hourFormat>=25)
{
set overHour [expr $hourFormat - 24]
set overTimeFormat "$overHour:$minFormat"
puts $overTimeFormat
}

#set realEndTimeFormat "$minFormat:$hourFormat"
}

 
a few things:

1st, don't keep opening a new thread/question ... stick to responding to your original question!

You have a few syntax errors:
1.) put your "{" on the same line as your if cmds
2.) 2nd if cmd: you have an open ")"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top