mirror of https://codeberg.org/cage/tinmop/
- improved 'fs:octects->units-string'.
This commit is contained in:
parent
0372b479ef
commit
fcc4070cc0
|
@ -544,20 +544,17 @@
|
||||||
(format nil (config:_ "invalid value: ~a") object))
|
(format nil (config:_ "invalid value: ~a") object))
|
||||||
|
|
||||||
(defmethod octects->units-string ((object number))
|
(defmethod octects->units-string ((object number))
|
||||||
(let ((decimals (loop
|
(let ((decimals (1- (num-utils:count-digit object))))
|
||||||
for number = object then (truncate (/ number 10)) while (> number 0)
|
|
||||||
for results = 0 then (1+ results)
|
|
||||||
finally (return results))))
|
|
||||||
(cond
|
(cond
|
||||||
((or (null decimals)
|
((or (null decimals)
|
||||||
(<= decimals 3))
|
(< decimals 3))
|
||||||
(format nil (config:_ "~a bytes") object))
|
(format nil (config:_ "~a bytes") object))
|
||||||
((<= 4 decimals 6)
|
((<= 3 decimals 5)
|
||||||
(format nil (config:_ "~a Kib") (truncate (octects->units object :kib))))
|
(format nil (config:_ "~,1f Kib") (octects->units object :kib)))
|
||||||
((<= 7 decimals 9)
|
((<= 6 decimals 8)
|
||||||
(format nil (config:_ "~a Mib") (truncate (octects->units object :mib))))
|
(format nil (config:_ "~,1f Mib") (octects->units object :mib)))
|
||||||
(t
|
(t
|
||||||
(format nil (config:_ "~a Gib") (truncate (octects->units object :gib)))))))
|
(format nil (config:_ "~,1f Gib") (octects->units object :gib))))))
|
||||||
|
|
||||||
(defgeneric normalize-path (object))
|
(defgeneric normalize-path (object))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue