Cygwin strptime() is missing "%s" which strftime() has

Kaz Kylheku 920-082-4242@kylheku.com
Mon Jul 24 21:02:00 GMT 2017


On 23.07.2017 19:09, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:
>> But that's just scanning a decimal integer to time_t.
> 
> It's not a question of whether I can or can't convert a string into an
> integer, rather it's a question about portability of code that uses %s
> for both functions and expects it to work unchanged in the Cygwin
> environment.  Also, strptime() was designed to be a reversal to
> strftime() (from the man-pages: the  strptime() function is the
> converse function to strftime(3)) so both are supposed to "understand"
> the same basic set of formats.  Because of Cygwin's strptime() missing
> "%s", the following also does not work even from command line:
> 
> $ date +"%s" | strptime "%s"
> strptime: cannot make sense of `1500861577' using the given input 
> formats

There is no %s in POSIX. It is a GNU C library extension. Thus this is
only a matter of compatibility between Cygwin and GNU/Linux (and 
portability
between those systems).

Linux compatibility *is* an explicit goal of the Cygwin project. If %s 
works
on Linux but not Cygwin, in that moment you're not getting quite that
"Linux feeling" on Windows.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list