all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: emacs-devel@gnu.org
Subject: Re: Decoded time accessors
Date: Sun, 07 Jul 2019 22:09:21 +0200	[thread overview]
Message-ID: <m3v9wdtxn2.fsf@gnus.org> (raw)
In-Reply-To: <ba81679e-7eb5-c832-13d2-9f53e254f1b0@cs.ucla.edu> (Paul Eggert's message of "Sun, 7 Jul 2019 12:52:34 -0700")

Paul Eggert <eggert@cs.ucla.edu> writes:

> Lars Ingebrigtsen wrote:
>> I hate reading code that says (elt decoded 5) and then
>> have to look up the doc string and then count to be able to tell what
>> it's doing
>
> I dislike that too. Luckily, it doesn't happen too often for me. I try
> to avoid it by using format-time-string instead of decode-time.

Yup, but when writing code to manipulate times, it's often easier to
work on the decoded time instead of manipulating the other time forms.
(For instance, getting "next day at the same time" is much easier in
decoded time, because that can be 23, 24 or 25 hours depending on
DST...)

> What do Common Lisp hackers do? Common Lisp has a similar function
> decode-universal-time, so they must have a similar problem.

Yup.  I can only speak for myself, and we ended up with similar things
to what I'm proposing, only...  more organically grown over the years.
:-)

> Where in the source code would you put the accessors?

I was looking around in the tree, and I haven't really found a good
place to put them...  parse-time.el isn't basic enough, and the really
base time functions are in C.  So...  perhaps simple.el?  Or a new file,
decoded-time.el? 

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



  reply	other threads:[~2019-07-07 20:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-07 19:33 Decoded time accessors Lars Ingebrigtsen
2019-07-07 19:52 ` Paul Eggert
2019-07-07 20:09   ` Lars Ingebrigtsen [this message]
2019-07-07 21:43 ` Alan Mackenzie
2019-07-07 22:20   ` Lars Ingebrigtsen
2019-07-07 22:25   ` Clément Pit-Claudel
2019-07-08 14:41   ` Eli Zaretskii
2019-07-09  0:12   ` Accessor functions vs nth (WAS: Decoded time accessors) Noam Postavsky
2019-07-10 10:02     ` João Távora
2019-07-29 12:29 ` Decoded time accessors 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=m3v9wdtxn2.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.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.