mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-21 04:12:37 +09:00
bug #1130: add period_to_str method
This methods is used to create strings for time periods with this format: 80d 10:23:33
This commit is contained in:
1 parent
6e718906bd
commit
407350bbb1
1 file changed
+9
@@ -364,6 +364,15 @@ EOT
|
||||
end
|
||||
end
|
||||
|
||||
def OpenNebulaHelper.period_to_str(time)
|
||||
seconds=time.to_i
|
||||
minutes, seconds=seconds.divmod(60)
|
||||
hours, minutes=minutes.divmod(60)
|
||||
days, hours=hours.divmod(24)
|
||||
|
||||
"%4dd %02d:%02d:%02d" % [days, hours, minutes, seconds]
|
||||
end
|
||||
|
||||
BinarySufix = ["K", "M", "G", "T" ]
|
||||
|
||||
def OpenNebulaHelper.unit_to_str(value, options, unit="K")
|
||||
|
||||
Reference in new issue
Block a user