[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master d0c77a1: Remove some assumptions about timestamp format
From: |
Michael Albinus |
Subject: |
Re: master d0c77a1: Remove some assumptions about timestamp format |
Date: |
Fri, 28 Sep 2018 12:26:54 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Eli Zaretskii <address@hidden> writes:
>> I'm afraid we need something better than that, as it mishandles NaNs.
>> Also, there's no need for a special "invalid_time" value; you can just
>> use a NaN.
>
> It's OK to support NaNs in time values, but I'm uneasy with the
> recommendation to use NaN as an invalid time. IMO, NaNs should only
> come out of calculations, never from initial literal values of a
> program (except when the program wants to test NaN handling).
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.
> What is the problem with having a special invalid time value?
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.
(write-region "foo" nil "/tmp/foo")
(set-file-times "/tmp/foo" 0.0e+NaN)
=> (error "Specified time is not representable")
`set-file-times' shall simply return nil in this case, as said in the
docstring.
Therefore it would be better to a have an agreed constant, which is
understood by both Tramp and its callers.
What's wrong with the result of invalid_timespec() of systime.h, as
proposed earlier?
Best regards, Michael.
- Re: master d0c77a1: Remove some assumptions about timestamp format, Michael Albinus, 2018/09/25
- Re: master d0c77a1: Remove some assumptions about timestamp format, Paul Eggert, 2018/09/25
- Re: master d0c77a1: Remove some assumptions about timestamp format, Michael Albinus, 2018/09/26
- Re: master d0c77a1: Remove some assumptions about timestamp format, Paul Eggert, 2018/09/27
- Re: master d0c77a1: Remove some assumptions about timestamp format, Eli Zaretskii, 2018/09/28
- Re: master d0c77a1: Remove some assumptions about timestamp format,
Michael Albinus <=
- Re: master d0c77a1: Remove some assumptions about timestamp format, Paul Eggert, 2018/09/28
- Re: master d0c77a1: Remove some assumptions about timestamp format, Michael Albinus, 2018/09/29
- Re: master d0c77a1: Remove some assumptions about timestamp format, Paul Eggert, 2018/09/28
- Re: master d0c77a1: Remove some assumptions about timestamp format, Michael Albinus, 2018/09/28
- Re: master d0c77a1: Remove some assumptions about timestamp format, Paul Eggert, 2018/09/27
- Re: master d0c77a1: Remove some assumptions about timestamp format, Michael Albinus, 2018/09/28
- Re: master d0c77a1: Remove some assumptions about timestamp format, Paul Eggert, 2018/09/28
- Naming predicates (was: master d0c77a1: Remove some assumptions about timestamp format), Stefan Monnier, 2018/09/28
- RE: Naming predicates (was: master d0c77a1: Remove some assumptions about timestamp format), Drew Adams, 2018/09/28
- Re: Naming predicates (was: master d0c77a1: Remove some assumptions about timestamp format), Paul Eggert, 2018/09/28