From: Tim Landscheidt <tim@tim-landscheidt.de>
To: help-gnu-emacs@gnu.org
Subject: Counterpart to time-to-days?
Date: Wed, 29 May 2019 12:20:49 +0000 [thread overview]
Message-ID: <87imttmoym.fsf@passepartout.tim-landscheidt.de> (raw)
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
next reply other threads:[~2019-05-29 12:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-29 12:20 Tim Landscheidt [this message]
2019-05-29 21:03 ` Counterpart to time-to-days? Bruno Barbier
2019-05-30 13:52 ` Tim Landscheidt
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=87imttmoym.fsf@passepartout.tim-landscheidt.de \
--to=tim@tim-landscheidt.de \
--cc=help-gnu-emacs@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.