-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add RfcUtcTime compilation option #152
Conversation
README.md
Outdated
@@ -392,6 +392,13 @@ Possible values are: | |||
|
|||
https://en.wikipedia.org/wiki/Unix_time | |||
|
|||
- `UnixTimeReadable` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other concerns about the reasonableness aside, UnixTimeReadable
is a bit of a red herring of an option name.
It's not about the "readability" (RfcTime
is readable for example), it's about the UTC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the essence of Unix time is really that it's the seconds (or similar -- milliseconds or nanoseconds) count. If it's not that, it's not any kind of "Unix time" or epoch time.
I do wonder somewhat why the approach described in status-im/status-desktop#15198 (comment) isn't applicable here:
Presumably the issue here is that
Also, Other options are to add explicitly logged attributes in whatever timezone or formatting one wants. A bit redundant, but depends how scaffolding-y this is all meant to be. |
@tersec yes, this is exactly the reason. This is needed for So changing OS clock is not an option here. |
I think it looks better now. Thanks for the naming suggestions @tersec ! ( we had a private chat ) |
2ec06c3
to
580f64a
Compare
chronicles/log_output.nim
Outdated
@@ -454,29 +454,35 @@ proc getSecondsPart(timestamp: Time): string = | |||
res[5] = chr(ord('0') + (tmp mod 10)) | |||
res | |||
|
|||
proc getFastDateTimeString(): string = | |||
proc getFastDateTimeString(useUtc = false): string = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the default here?
# Cache string representation of zone part | ||
let tmp = datetime.format("zzz") | ||
cachedZoneArray = toArray(6, tmp.toOpenArrayByte(0, 5)) | ||
if not useUtc: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's an if for every formatting statement here - maybe accept that these are separate functions..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much indeed for the comments!
For this particular one, I think it is better to keep it in the same proc
to avoid possible leftovers if we change that logic in the future.
# Cache string representation of zone part | ||
let tmp = datetime.format("zzz") | ||
cachedZoneArray = toArray(6, tmp.toOpenArrayByte(0, 5)) | ||
if not useUtc: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even so, most of it can be avoided..
let timezone =
if useUtc: "Z"
else:
...
string.fromBytes(cachedZoneArray)
Adding a simple option to allow logging using UTC TimeZone instead of the local one
This PR is motivated by these comments: status-im/status-desktop#15198 (comment) and status-im/status-desktop#15198 (comment) :)