From: Paul Eggert <eggert@cs.ucla.edu>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: master d0c77a1: Remove some assumptions about timestamp format
Date: Fri, 28 Sep 2018 10:27:39 -0700 [thread overview]
Message-ID: <dde9f9e9-1e3e-ee1b-c6ae-02906f3c3e4e@cs.ucla.edu> (raw)
In-Reply-To: <87bm8hape9.fsf@gmx.de>
Michael Albinus wrote:
> Indeed. A NaN is not a time value all time functions do understand. For
> example,
>
> (current-time-string 0.0e+NaN)
> => (error "Specified time is not representable")
>
> I believe, a special string shall be returned here, like
> "Unspecified time" or so.
I'm afraid that sort of thing won't do in general. For example, what would
format-time-string do? Or decode-time?
> Tramp will use such a constant anyway, it has taken '(0 0) until now. It
> will be returned by Tramp implementations of functions like
> `file-attributes' or `visited-file-modtime', and must be understood by
> the calling functions. `set-file-times', for example, does not
> understand this, and so do the functions in ls-lisp.el, and likely in
> Lisp packages in the wild.
If I understand you aright, you want a time value that will be treated as valid
by standard time functions, and yet won't be a time value that any actual
filesystem would return. In that case I suggest using the timestamp (0 0 0 1000)
at the Lisp level. Although this is almost exactly the same time value that your
Vinvalid_time code was using, it doesn't require special support at the C level.
Alternatively you could use (-1 65535 999999 999999), which is exactly the same
value that your C code was effectively using. However, if it's run through
struct timespec by the C code it will be floored to (-1 65535 999999 999000).
Also, it can have problems on platforms where time_t is unsigned, which POSIX
allows, and there are a few oddball systems that do that (QNX and VMS come to
mind); although I don't know whether Emacs runs on these systems it'd be better
not to exclude them arbitrarily. Another option would be (0 0 0 1), but I worry
that this also would not survive an internal round trip through struct timespec.
All struct timespec-compatible timestamps are possible timestamps in the
filesystem I use regularly (ext4). However, (0 0 0 1000) is so unlikely I don't
think we need to worry about this, which is in contrast to the current Tramp
usage of (0 0) which corresponds to timestamps that I have seen on real
filesystems for various reasons.
next prev parent reply other threads:[~2018-09-28 17:27 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
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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dde9f9e9-1e3e-ee1b-c6ae-02906f3c3e4e@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=eliz@gnu.org \
--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 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.