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
19 Apr 2024 05:03:02 EDT (-0400)
  Re: POV-Ray v3.8.0-beta 1 - Parse error using "%s" in Win10  
From: clipka
Date: 25 Jul 2021 08:44:15
Message: <60fd5c9f$1@news.povray.org>
Am 25.07.2021 um 09:45 schrieb Thomas de Groot:

> #declare seed_ = val(datetime(now,"%s"));

> "POV-Ray's documentation says the "..optional STRING parameter should
> conform to the same formatting as that of the strftime() C function."
> and (lowercase) "%s" is documented as described and used.  I assume
> that the Windows 'strftime()' does not provide that option?  else it
> would be a POV-Ray on Windows bug, I guess."

 From the Linux man page on die.net (https://linux.die.net/man/3/strftime):
--------------------------------------------------------------
%s

The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). 
(TZ)
--------------------------------------------------------------

For information on what "(TZ)" means, see further on that page:

--------------------------------------------------------------
Conforming To

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

For a list of values officially supported by standard C/C++, see 
https://en.cppreference.com/w/c/chrono/strftime.


TL;DR:

"%s" is a non-standard extension to the `strftime` format, that is not 
universally supported.


Also note that in POV-Ray, `now` already is a numeric value (albeit in 
days, and with 0 corresponding to 2000-1-1, 00:00:00 am UTC). It should 
be trivial to convert to a Unix timestamp without the use of `datetime` 
and `val`, using simple scalar math.


Post a reply to this message

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