Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
600747e1ac | |||
08c0962b40 |
@ -4,22 +4,19 @@ const zeroTime = fromUnix(0)
|
||||
const ISO_8601_FORMATS = @[
|
||||
"yyyy-MM-dd'T'HH:mm:ssz",
|
||||
"yyyy-MM-dd'T'HH:mm:sszzz",
|
||||
"yyyy-MM-dd'T'HH:mm:ss'.'fffzzz"
|
||||
"yyyy-MM-dd'T'HH:mm:ss'.'fffzzz",
|
||||
"yyyy-MM-dd HH:mm:ssz",
|
||||
"yyyy-MM-dd HH:mm:sszzz",
|
||||
"yyyy-MM-dd HH:mm:ss'.'fffzzz"
|
||||
]
|
||||
|
||||
proc format*(ti: TimeInterval, fmt: string): string =
|
||||
let info = (fromUnix(0) + ti).utc
|
||||
let info = (zeroTime + ti).utc
|
||||
return info.format(fmt)
|
||||
|
||||
# Will be deprecated in Nim 0.18.1 as it will exist in the standard times module.
|
||||
proc `-`*(a, b: DateTime): Duration {.deprecated} =
|
||||
return times.`-`(a,b)
|
||||
|
||||
proc `<`*(a, b: DateTime): bool {.deprecated} =
|
||||
return times.`<`(a,b)
|
||||
|
||||
proc `<=`*(a, b: DateTime): bool {.deprecated} =
|
||||
return times.`<=`(a,b)
|
||||
proc format*(d: Duration, fmt: string): string =
|
||||
let info = (fromUnix(0) + d).utc
|
||||
return info.format(fmt)
|
||||
|
||||
proc `<`*(a, b: TimeInterval): bool =
|
||||
return (zeroTime + a) < (zeroTime + b)
|
||||
|
@ -1,11 +1,10 @@
|
||||
# Package
|
||||
|
||||
version = "0.5.0"
|
||||
version = "0.5.2"
|
||||
author = "Jonathan Bernard"
|
||||
description = "Utility methods to fill in the lacking time support in Nim\'s stdlib. This is holding me over until I can write a proper time module for the stdlib and submit it."
|
||||
description = "Utility methods to fill in the lacking time support in Nim\'s stdlib."
|
||||
license = "BSD3"
|
||||
|
||||
# Dependencies
|
||||
|
||||
requires "nim >= 0.19.0"
|
||||
|
||||
requires "nim >= 1.0.0"
|
||||
|
Reference in New Issue
Block a user