unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Michael Albinus <michael.albinus@gmx.de>, emacs-devel@gnu.org
Subject: Re: master d0c77a1: Remove some assumptions about timestamp format
Date: Tue, 25 Sep 2018 18:09:39 -0700	[thread overview]
Message-ID: <b58efb93-3a91-de6a-014b-198c89603270@cs.ucla.edu> (raw)
In-Reply-To: <87bm8lanwu.fsf@gmx.de>

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	other threads:[~2018-09-26  1:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180925021527.10418.61555@vcs0.savannah.gnu.org>
     [not found] ` <20180925021528.9A119204E8@vcs0.savannah.gnu.org>
2018-09-25 10:09   ` master d0c77a1: Remove some assumptions about timestamp format Michael Albinus
2018-09-26  1:09     ` Paul Eggert [this message]
2018-09-26  9:24       ` Michael Albinus
2018-09-26  9:39         ` Eli Zaretskii
2018-09-26  9:43           ` Michael Albinus
2018-09-27 20:46         ` Paul Eggert
2018-09-28  6:32           ` Eli Zaretskii
2018-09-28 10:26             ` Michael Albinus
2018-09-28 17:27               ` Paul Eggert
2018-09-29 13:35                 ` Michael Albinus
2018-09-28 14:45             ` Paul Eggert
2018-09-28 14:54               ` Michael Albinus
2018-09-28  1:50         ` Paul Eggert
2018-09-28 10:35           ` Michael Albinus
2018-09-28 17:39             ` Paul Eggert
2018-09-28 18:06               ` Naming predicates (was: master d0c77a1: Remove some assumptions about timestamp format) Stefan Monnier
2018-09-28 18:28                 ` Drew Adams
2018-09-28 19:12                   ` Paul Eggert
2018-09-28 19:26                     ` Naming predicates Stefan Monnier
2018-09-28 19:40                       ` Drew Adams
2018-09-28 19:41                     ` Naming predicates (was: master d0c77a1: Remove some assumptions about timestamp format) Drew Adams

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b58efb93-3a91-de6a-014b-198c89603270@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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