emacs-devel
[Top][All Lists]
Advanced

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

Re: master d0c77a1: Remove some assumptions about timestamp format


From: Paul Eggert
Subject: Re: master d0c77a1: Remove some assumptions about timestamp format
Date: Tue, 25 Sep 2018 18:09:39 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0

On 9/25/18 3:09 AM, Michael Albinus wrote:
In the different tramp*.el files, '(0 0) is explicitly quoted as "don't
know value". This is there for ages.

If you want to change this in the tests, it shall be changed in
tramp*.el as well. Maybe it would be even worth an own constant?
Something like

(defconst time-dont-know (seconds-to-time 0)
   "A time value indicating an unknown time.")

If you like, it could even have the value 0 instead of (seconds-to-time
0). But this would also introduce "some assumptions of Lisp code on
timestamp format" - what you try to avoid.


A constant like that would make things clearer, yes. Either 0 or (0 0 0 0) or (0 0) should do, so I suggest just 0 as it's simplest. While you're at it, you might consider changing the number from 0 to a negative value, say -1 (the value that POSIX uses for invalid time_t), since that's less likely to collide with actual file timestamps (timestamp 0 is far more common than timestamp -1 in real filesystems in my experience).

The Tramp code shouldn't care whether the constant is 0 or (0 0) or (0 0 0 0) [or -1 or (-1 65535) or (-1 65535 0 0)], because the code should compare time stamps via time-less-p (or float-time, if the timestamps are known to be small like 0 or -1, or maybe we should add time-equal?), not via 'equal'. The idea is that the Lisp timestamp format has changed in the past and is likely to change in the future and one should not assume any particular format if one wants the code to be portable.




reply via email to

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