module MS
Extended Modules
Defined in:
ms/version.crms.cr
Constant Summary
-
VERSION =
"0.1.2"
Instance Method Summary
-
#ms(val : Int32 | Int64, long = false) : String
Convert integer of the milliseconds to an formatted string.
-
#ms(val : String) : Int64
Convert string to an integer of the milliseconds.
Instance Method Detail
def ms(val : Int32 | Int64, long = false) : String
#
Convert integer of the milliseconds to an formatted string.
# Short format
MS.ms(60 * 60 * 1000 * 6) # => "6h"
# Long format
MS.ms(1000, long: true) # => "1 second"
def ms(val : String) : Int64
#
Convert string to an integer of the milliseconds.
MS.ms("5h") # => 18000000