POV-Ray : Newsgroups : povray.beta-test : POV-Ray v3.8.0-beta 1 - Parse error using "%s" in Win10 : Re: POV-Ray v3.8.0-beta 1 - Parse error using "%s" in Win10 Server Time
20 Oct 2021 19:10:39 EDT (-0400)
  Re: POV-Ray v3.8.0-beta 1 - Parse error using "%s" in Win10  
From: clipka
Date: 25 Jul 2021 17:23:38
Message: <60fdd65a$1@news.povray.org>
Am 25.07.2021 um 15:28 schrieb jr:

> do you have a reference for the "non-standard", please?  cannot see a mention on
> the pages I looked at, including
> <https://man7.org/linux/man-pages/man3/strftime.3.html>.

(1)

The official reference for the fact that it's non-standard would be the 
official documentation of the C and C++ standards: ISO/IEC 9899 and 
ISO/IEC 14882, respectively, in whatever revision of the language you're 
looking at. Of those, the C documentation is the more interesting, as 
the C++ standard only defines it by reference.

The non-standard status of "%s" is documented in ISO-IEC 9899 by 
absence: It is not mentioned, therefore it is non-standard.

I do not have access to an authoritative copy of any revision of ISO/IEC 
9899 aside a PDF copy of good old ANS/ISO 9899-1990, but there the 
relevant information would be found on page 174, in section 7.12.3.5, 
"The strftime function"

For ISO/IEC 9899:1999, that forms the main basis for C++, I only have 
access to drafts (access to authoritative ISO/IEC standard documents 
requires a license fee). In a PDF titled "ISO/IEC Committee Draft - May 
6, 2005 ISO/IEC 9899:TCs" (which to the best of my knowledge differs 
from ISO/IEC 9899:1999 only in "bugfixes"), the relevant information 
would be found on page 7.23.3.5, "Tthe strftime function".

In the official ANSI PDF release of ISO/IEC 14882:2011(E), the relevant 
information can be found on page 619, section 20.11.8 [date.time] "Date 
and time functions", but it only references the C standard. (The 
footnote explicitly listing conversion specifies from C seems to be 
intended to only explicitly affirm that C++11 supports those specifiers 
added in C99, rather than the smaller set in C89.)


(2)

The page I've linked to, "cppreference.com", is dedicated to faithfully 
documenting the official standard in a more accessible format, and has 
proven quite reliable in being true to the standards and their versions.

The page you're citing documents what is implemented in Linux' glibc. It 
is not authoritative about what to expect from `strftime` on a 100% pure 
standard-conformant system.


(3)

The page you liked to, under "%s", also lists effectively the same 
information as the other man page source I cited:

--------------------------------------------------------------
%s     The number of seconds since the Epoch, 1970-01-01 00:00:00
               +0000 (UTC). (TZ) (Calculated from mktime(tm).)
--------------------------------------------------------------

Again, note the "(TZ)" here. In the section titled "CONFORMING TO", it 
also explains what this "(TZ)" marker means, again just like the man 
page source I cited:

--------------------------------------------------------------

        SVr4, C89, C99.  There are strict inclusions between the set of
        conversions given in ANSI C (unmarked), those given in the Single
        UNIX Specification (marked SU), those given in Olson's timezone
        package (marked TZ), and those given in glibc (marked GNU),
        except that %+ is not supported in glibc2.  On the other hand
        glibc2 has several more extensions.  POSIX.1 only refers to ANSI
        C; POSIX.2 describes under date(1) several extensions that could
        apply to strftime() as well.  The %F conversion is in C99 and
        POSIX.1-2001.

--------------------------------------------------------------

In other words:
- If it is marked "(GNU)", it is supported by glibc.
- If it is marked "(TZ)", it is supported by glibc and "Olson's timezone 
package"
- If it is marked "(SU)", it is supported by glibc and "Olson's timezone 
package", and standardized for Unix in the Single UNIX Specification.
- If it is unmarked, it is supported by glibc and "Olson's timezone 
package", and standardized for Unix in the Single UNIX Specification and 
ANSI C (which in this case appears to mean ANSI-standard C in general, 
not specifically C89 as would usually be the case. ).


(4)

It may be worth noting that Linux' strftime is _not_ in violation of the 
C (and, by extension, C++) standard, which explicitly states: "If a 
conversion specilier is not one of the above. the behavior is 
undefined." In other words, "%s" may crash the program, produce "F*** 
you" as output, or convert the time to a decimal rendition of the number 
of seconds between the very start of 1970 and the specified time. Any of 
these behaviors are acceptable per the C/C++ standard.


Post a reply to this message

Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.