if {$uptime < 60} {
set uptime [format %.2d $uptime]
} elseif {$uptime < 3600} {
set mins [expr $uptime / 60]
set secs [expr $uptime - ($mins * 60)]
set uptime "[format %.2d $mins]:[format %.2d $secs]"
} elseif {$uptime < 86400} {
set hours [expr $uptime / 3600]
set mins [expr ($uptime - ($hours * 3600)) / 60]
set secs [expr $uptime - (($hours * 3600) + ($mins * 60))]
set uptime "${hours}:[format %.2d $mins]:[format %.2d $secs]"
} else {
set days [expr $uptime / 86400]
set hours [expr ($uptime - ($days * 86400)) / 3600 ]
set mins [expr ($uptime - (($days * 86400) + ($hours * 3600))) / 60]
set secs [expr ($uptime - (($days * 86400) + ($hours * 3600) + ($mins * 60)))]
set uptime "${days}d[format %.2d $days]h[format %.2d $mins]m[format %.2d $secs]s"
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment