module MS

Extended Modules

Defined in:

ms/version.cr
ms.cr

Constant Summary

VERSION = "0.1.2"

Instance Method Summary

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"

[View source]
def ms(val : String) : Int64 #

Convert string to an integer of the milliseconds.

MS.ms("5h") # => 18000000

[View source]