9fd84a8938
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1814 2a923420-c742-0410-a762-8d5b09965624
16 lines
277 B
Plaintext
16 lines
277 B
Plaintext
|
|
if {![exists -proc pretty_size]} {
|
|
proc pretty_size {size} {
|
|
set units {bytes KiB MiB GiB TiB}
|
|
|
|
for {set i 0} {$size > 1023} {incr i} {
|
|
set size $($size / 1024.0)
|
|
}
|
|
|
|
set size [string trimright [format "%.2f" $size] "0."]
|
|
|
|
return "$size [lindex $units $i]"
|
|
}
|
|
}
|
|
|