This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Cygwin strptime() is missing "%s" which strftime() has
- From: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr at ncbi dot nlm dot nih dot gov>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Mon, 24 Jul 2017 02:09:46 +0000
- Subject: Re: Cygwin strptime() is missing "%s" which strftime() has
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=lavr at ncbi dot nlm dot nih dot gov;
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
> 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
Thank you,
Anton Lavrentiev
Contractor NIH/NLM/NCBI
--
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