edu_increment_time

one of the documented procedures in this installation of the ACS
Usage:
edu_increment_time   display_hour   display_minute   display_ampm   time_increment   { toggle_ampm "t" }
What it does:
This adds the time increment to the passed in values and then returns a list of hour, minute, and ampm and whether or not the ampm should be toggled again
Defined in: /web/philip/tcl/education.tcl

Source code:



    set display_minute [expr $display_minute + $time_increment]
    if {$display_minute >= 60} {
	# by default, the expr / drops the remainder
	set hours_to_add [expr $display_minute / 60]
	set display_minute [expr $display_minute % 60]
	if {$display_minute < 10} {
	    set display_minute 0${display_minute}
	}
	set display_hour [expr $display_hour + $hours_to_add]
    } 
    if {$display_hour >= 12} {
	if {[string compare $toggle_ampm t] == 0} {
	    # we want to toggle the am/pm
	    if {[string compare [string tolower $display_ampm] am] == 0} {
		set display_ampm PM
	    } else {
		set display_ampm AM
	    }
	}
	if {$display_hour > 12 } {
	    set display_hour [expr $display_hour % 12]
	    set toggle_ampm t
	} else {
	    set toggle_ampm f
	} 
    }	
    
    return [list $display_hour $display_minute $display_ampm $toggle_ampm]


philg@mit.edu