all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Lars Ingebrigtsen <larsi@gnus.org>,
	Andy Moreton <andrewjmoreton@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: encode-time vs decode-time
Date: Tue, 30 Jul 2019 17:50:11 -0500	[thread overview]
Message-ID: <ff71edb8-898b-d2a7-54f0-a5873e64d938@cs.ucla.edu> (raw)
In-Reply-To: <502b23f8-58ed-38ff-ae50-fae391129a10@cs.ucla.edu>

On 7/30/19 12:54 PM, I wrote:
>
> So, how about this idea. First we go along the lines of your 
> suggestion, and change decode-time to return a ninth slot with a 
> numerator-denominator pair that preserves all the precision of its 
> argument. Second, we change (encode-time TIME t) so that it also 
> preserves all the precision of its argument. This will cause 
> (encode-time (decode-time TIME) t) to return a value equivalent to 
> TIME, which will simplify roundtripping.

Come to think of it, we would also need to change this obsolescent API 
for encode-time:

> As an obsolescent calling convention, if this function is called with
> 6 or more arguments, the first 6 arguments are SECOND, MINUTE, HOUR,
> DAY, MONTH, and YEAR, and specify the components of a decoded time,
> where DST assumed to be -1 and FORM is omitted.  If there are more
> than 6 arguments the *last* argument is used as ZONE and any other
> extra arguments are ignored, so that (apply #'encode-time
> (decode-time ...)) works; otherwise ZONE is assumed to be nil.

Several places in the code use this obsolete API and do (apply 
#'encode-time FOO) where FOO is either the munged result of an earlier 
decode-time or is created from scratch. So, if we made the change as 
described above, we'd also need to change the obsolescent API to be 
something like this:

"As an obsolescent calling convention, if this function is called with 6 
or more arguments, the first 6 arguments are SECOND, MINUTE, HOUR, DAY, 
MONTH, and YEAR, and specify the components of a decoded time, where DST 
assumed to be -1 and FORM is omitted. If there are between 7 and 9 
arguments the *last* argument is used as ZONE and if there are 10 
arguments the 9th is used as ZONE and the 10th as a fractional-second 
argument (TICKS . HZ) and in either case any other extra arguments are 
ignored, so that (apply #'encode-time (decode-time ...)) works. In this 
obsolete convention, the default  ZONE is nil and the default fractional 
second is zero."

Good thing that API is "obsolescent"....




  reply	other threads:[~2019-07-30 22:50 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 [this message]
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
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff71edb8-898b-d2a7-54f0-a5873e64d938@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=andrewjmoreton@gmail.com \
    --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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.