public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Kaz Kylheku <920-082-4242@kylheku.com>
To: cygwin@cygwin.com
Subject: Re: Cygwin strptime() is missing "%s" which strftime() has
Date: Mon, 24 Jul 2017 21:02:00 -0000	[thread overview]
Message-ID: <35cc661bda95310f57e9844bebf27158@mail.kylheku.com> (raw)
In-Reply-To: <BY1PR09MB0343663DE41D927E67CF0CCEA5BB0@BY1PR09MB0343.namprd09.prod.outlook.com>

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

  parent reply	other threads:[~2017-07-24 20:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24  9:21 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2017-07-24 10:53 ` Corinna Vinschen
2017-07-24 21:02 ` Kaz Kylheku [this message]
2017-07-24 21:28 ` Hans-Bernhard Bröker
2017-07-24 23:18   ` Brian Inglis
2017-07-24 23:31     ` Kaz Kylheku
2017-07-25 18:27       ` Brian Inglis
2017-08-30  0:25         ` Brian Inglis
  -- strict thread matches above, loose matches on Subject: below --
2017-07-24 21:48 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2017-07-24 22:12 ` Eric Blake
2017-07-24 22:51   ` Brian Inglis
2017-07-24 19:51 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2017-07-24 13:54 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2017-07-24 17:02 ` Eric Blake
2017-07-23 11:38 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2017-07-23 21:18 ` Kaz Kylheku

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35cc661bda95310f57e9844bebf27158@mail.kylheku.com \
    --to=920-082-4242@kylheku.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).