all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bruno Barbier <brubar.cs@gmail.com>
To: Tim Landscheidt <tim@tim-landscheidt.de>, help-gnu-emacs@gnu.org
Subject: Re: Counterpart to time-to-days?
Date: Wed, 29 May 2019 23:03:04 +0200	[thread overview]
Message-ID: <5ceee589.1c69fb81.2145e.33c3@mx.google.com> (raw)
In-Reply-To: <87imttmoym.fsf@passepartout.tim-landscheidt.de>


Hi,

Tim Landscheidt <tim@tim-landscheidt.de> writes:

> Hi,
>
...

> | 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?

Are you looking for `time-to-number-of-days` ?

   (format-time-string "%F" (days-to-time (time-to-number-of-days (current-time))))
   => 2019-05-29
      

Bruno

> How is date arithmetic supposed to be done in Emacs Lisp?

>
> TIA,
> Tim



  reply	other threads:[~2019-05-29 21:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29 12:20 Counterpart to time-to-days? Tim Landscheidt
2019-05-29 21:03 ` Bruno Barbier [this message]
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=5ceee589.1c69fb81.2145e.33c3@mx.google.com \
    --to=brubar.cs@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tim@tim-landscheidt.de \
    /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.