[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 27.0.60; Asymmetry between (days-to-time) and (time-to-days)

From: Paul Eggert
Subject: Re: 27.0.60; Asymmetry between (days-to-time) and (time-to-days)
Date: Tue, 24 Mar 2020 09:51:33 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 3/24/20 2:18 AM, Kevin Liu wrote:
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))))

Even if time-to-days and days-to-time were inverses, this usage would be dubious since the conversion back and forth would discard the fractional date and that could cause format-time-string to do the wrong thing when the timestamp was near a year boundary in a non-UTC timezone.

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

We could add an optional argument to days-to-time; if it's t then days-to-time could add 719162 to its argument before converting (or whatever the magic number happens to be; I didn't check this).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]