HBDateCache
public final class HBDateCache
Current date cache.
Getting the current date formatted is an expensive operation. This creates a scheduled task that will
update a cached version of the date in the format as detailed in RFC1123 once every second. To
avoid threading issues it is assumed that currentDate
will only every be accessed on the same
EventLoop that the update is running.
-
Current formatted date
Declaration
Swift
public var currentDate: String
-
return date cache for this thread. If one doesn’t exist create one scheduled on EventLoop
Declaration
Swift
public static func getDateCache(on eventLoop: EventLoop) -> HBDateCache
-
Render Epoch seconds as RFC1123 formatted date
Declaration
Swift
public static func formatRFC1123Date(_ epochTime: Int) -> String
Parameters
epochTime
epoch seconds to render
Return Value
Formatted date