unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Counterpart to time-to-days?
@ 2019-05-29 12:20 Tim Landscheidt
  2019-05-29 21:03 ` Bruno Barbier
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Landscheidt @ 2019-05-29 12:20 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

prologue: With GNU Emacs 26.1, I have a list of UTC time-
stamp pairs that I want to transpose to the Europe/Berlin
time zone and group by a calculated "day" to print a shift-
plan.  For example, 2019-05-29T17:45:00Z gets (currently)
transformed to something similar to '(29 19 45), while
2019-05-29T22:30:00Z gets transformed to '(29 24 30) and
2019-05-30T03:30:00Z to '(29 29 30).  This part works just
fine.

Now I want to group and display them by week and day.  So I
applied time-to-days to the transposed timestamps (and then
planned to calculate the preceding Mondays for the minimum
and maximum days and iterate between them), but when I want-
ed to reconvert the day numbers with the fitting-by-name
days-to-time to display it as a date I hit the following id-
iosyncrasy:

| ELISP> (format-time-string "%F" (current-time))
| "2019-05-29"
| ELISP> (format-time-string "%F" (days-to-time (time-to-days (current-time))))
| "3988-05-29"
| ELISP>

So time-to-days seems to count the days from 0001-12-31bce,
while days-to-time (without being explicit about it) seems
to treat days as counting from epoch (1970-01-01).

What is the intended counterpart to time-to-days?  How is
date arithmetic supposed to be done in Emacs Lisp?

TIA,
Tim




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

end of thread, other threads:[~2019-05-30 13:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-29 12:20 Counterpart to time-to-days? Tim Landscheidt
2019-05-29 21:03 ` Bruno Barbier
2019-05-30 13:52   ` Tim Landscheidt

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).