all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 27.0.60; Asymmetry between (days-to-time) and (time-to-days)
@ 2020-03-24  9:18 Kevin Liu
  2020-03-24 16:51 ` Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Liu @ 2020-03-24  9:18 UTC (permalink / raw)
  To: emacs-devel

The asymmetry between (days-to-time) and (time-to-days) is quite surprising:

(format-time-string "%Y" (days-to-time (time-to-days (current-time))))
"3989"

One could work around this by using (time-to-number-of-days) which uses
the epoch time like (days-to-time), but that itself is awkwardly
asymmetric as it returns a float, as well as the asymmetric naming.

It's probably unrealistic that any existing behavior be changed, but it
would at least be nice to have a builtin function that is the inverse of
(time-to-days).  Org-mode, for example, seems to use the Gregorian
convention of (time-to-days) throughout, and to convert a (org-today) to
a time requires this mess:

(format-time-string "%Y" (days-to-time (- (org-today) 719162)))
"2020"



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-24 16:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-24  9:18 27.0.60; Asymmetry between (days-to-time) and (time-to-days) Kevin Liu
2020-03-24 16:51 ` Paul Eggert

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.