CoatyTimestamp
public struct CoatyTimestamp
Utility functions to cope with the Coaty compatible timestamp format. In
Coaty, a timestamp defines the number of milliseconds elapsed since January
1, 1970, 00:00:00 UTC. In Swift, a Coaty timestamp should be represented as
a Double
value.
-
Gets the Coaty compatible timestamp for the current date.
Declaration
Swift
public static func nowMillis() -> Double
Return Value
a Coaty timestamp representing number of milliseconds elapsed since January 1, 1970, 00:00:00 UTC, as a Double value.
-
Gets the Coaty compatible timestamp for the given
Date
.Declaration
Swift
public static func dateMillis(from: Date) -> Double
Return Value
a Coaty timestamp representing number of milliseconds elapsed since January 1, 1970, 00:00:00 UTC for the given
Date
, as a Double value. -
Gets the
Date
for the given Coaty compatible timestamp.Declaration
Swift
public static func date(from: Double) -> Date
Return Value
a
Date
that represents the given Coaty timestamp representing number of milliseconds elapsed since January 1, 1970, 00:00:00 UTC, as a Double value.