clojure-emacs / clojure-emacs/parseedn
handle timezones and milliseconds when parsing/printing inst
- Dominant language
- Emacs Lisp
- Stars
- 62
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
Currently we use `date-to-time` to parse `inst`, which ignores milliseconds and timezones. Seems there are a number of competing ways to represent time in elisp.
The [Time of Day info docs](https://www.gnu.org/software/emacs/manual/html_node/elisp/Time-of-Day.html) mention this format: `(sec-high sec-low microsec picosec)`, but the higher precision numbers may be omitted, which is what `date-to-time` does, so it just returns a pair of `(sec-high sec-low)`
`encode-time`/`decode-time` convert between this "lisp timestamp" format and `(SECOND MINUTE HOUR DAY MONTH YEAR IGNORED DST ZONE)`. Note that while this does have time zone info, it does not have sub-second resolution.
Emacs 27 adds `iso8601.el` which adds `iso8601-parse`, which returns the same structure as `decode-time` shown above, so again without milliseconds.
There is no inverse `iso8601-format`, it is not clear to me how one is supposed to format an ISO8601 time stamp. Ergoemacs shows [a snippet](http://ergoemacs.org/emacs/elisp_datetime.html) that combines multiple invocations of `format-time-string`.
I think with some cobbling together of what Emacs offers we should be able to at least support time zone parsing and printing, I think that's also the more urgent issue, although millisecond/nanosecond resolution would certainly be nice to have as well.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.