From: Paul Eggert <eggert@cs.ucla.edu>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: Support for sub-second time in decoded time
Date: Mon, 29 Jul 2019 11:46:14 -0500 [thread overview]
Message-ID: <09ec6cb4-af22-52f9-9881-a52f1d0c9cfb@cs.ucla.edu> (raw)
In-Reply-To: <m3ef29xjcd.fsf@gnus.org>
On 7/29/19 4:48 AM, Lars Ingebrigtsen wrote:
> Currently, encoded time has support for picoseconds. `decode-time' will
> throw away all sub-second time, which makes accurate round-tripping
> impossible.
No, it's quite possible. Say you want a resolution-R broken-down
representation of the Lisp timestamp T. Then you can use (decode-time T)
to get the broken-down time in seconds, and (mod (car (encode-time T R))
R) to get the subsecond part. Once you have that, you're off to the races.
Admittedly it is not that convenient. We could extend decode-time to
accept an additional argument FORM that would let the caller specify the
form of the returned value. decode-time could treat FORM much like
encode-time does, and encode-time would be extended to grok the new
forms so round-tripping would be simpler. This would be
upward-compatible with the current behavior.
For example, under this proposal we'd have:
(setq R 1000000000)
(setq X (encode-time nil R)) => (1564418451413082782 . 1000000000)
(setq Y (decode-time X nil)) => ((51413082782 . 1000000000) 40 9 29 7
2019 1 t -25200)
(equal X (encode-time Y R)) => t
next prev parent reply other threads:[~2019-07-29 16:46 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-29 9:48 Support for sub-second time in decoded time Lars Ingebrigtsen
2019-07-29 14:03 ` Stefan Monnier
2019-07-29 14:12 ` Lars Ingebrigtsen
2019-07-29 14:43 ` Stefan Monnier
2019-07-29 15:00 ` Lars Ingebrigtsen
2019-07-29 17:50 ` Stefan Monnier
2019-07-30 11:33 ` Lars Ingebrigtsen
2019-07-29 16:08 ` encode-time vs decode-time Stefan Monnier
2019-07-30 10:32 ` Lars Ingebrigtsen
2019-07-30 11:34 ` Andy Moreton
2019-07-30 11:37 ` Lars Ingebrigtsen
2019-07-30 17:54 ` Paul Eggert
2019-07-30 22:50 ` Paul Eggert
2019-07-31 19:03 ` Lars Ingebrigtsen
2019-07-31 19:31 ` Stefan Monnier
2019-08-06 1:48 ` Paul Eggert
2019-08-06 14:21 ` Eli Zaretskii
2019-08-06 15:59 ` Paul Eggert
2019-08-06 18:23 ` Eli Zaretskii
2019-08-07 1:02 ` Paul Eggert
2019-08-07 2:41 ` Stefan Monnier
2019-08-07 14:47 ` Eli Zaretskii
2019-08-11 23:39 ` Lars Ingebrigtsen
2019-08-17 6:47 ` Paul Eggert
2019-08-07 11:33 ` Lars Ingebrigtsen
2019-08-17 7:54 ` Paul Eggert
2019-08-17 8:16 ` Eli Zaretskii
2019-08-17 9:33 ` Paul Eggert
2019-08-17 20:46 ` Lars Ingebrigtsen
2019-08-17 20:56 ` Paul Eggert
2019-08-17 21:42 ` Stefan Monnier
2019-08-17 22:53 ` Paul Eggert
2019-08-19 21:12 ` Stefan Monnier
2019-08-21 10:55 ` Adam Porter
2019-08-21 20:20 ` Paul Eggert
2019-08-26 10:59 ` Adam Porter
2019-08-26 21:35 ` Paul Eggert
2019-08-07 14:44 ` Eli Zaretskii
2019-08-07 11:41 ` Lars Ingebrigtsen
2019-08-17 9:25 ` Paul Eggert
2019-08-17 20:51 ` Lars Ingebrigtsen
2019-07-29 14:23 ` Support for sub-second time in decoded time Eli Zaretskii
2019-07-29 14:59 ` Lars Ingebrigtsen
2019-07-29 16:46 ` Paul Eggert [this message]
2019-07-30 11:43 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=09ec6cb4-af22-52f9-9881-a52f1d0c9cfb@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).