Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v diff -u -r1.58 -r1.58.2.1 --- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 10 Nov 2003 17:23:02 -0000 1.58 +++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 20 Nov 2003 09:14:49 -0000 1.58.2.1 @@ -4596,3 +4596,20 @@ regsub -all {\]} $string {\]} string return $string } + +ad_proc -public util::interval_pretty { + {-seconds 0} +} { + Takes a number of seconds and returns a pretty interval of the form "3h 49m 13s" +} { + set result {} + if { $seconds > 0 } { + set hrs [expr $seconds / (60*60)] + set mins [expr ($seconds / 60) % 60] + set secs [expr $seconds % 60] + if { $hrs > 0 } { append result "${hrs}h " } + if { $hrs > 0 || $mins > 0 } { append result "${mins}m " } + append result "${secs}s" + } + return $result +}