[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
27.0.60; Asymmetry between (days-to-time) and (time-to-days)
From: |
Kevin Liu |
Subject: |
27.0.60; Asymmetry between (days-to-time) and (time-to-days) |
Date: |
Tue, 24 Mar 2020 02:18:27 -0700 |
User-agent: |
mu4e 1.3.10; emacs 27.0.60 |
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"
- 27.0.60; Asymmetry between (days-to-time) and (time-to-days),
Kevin Liu <=