Re: things I don't understand in src/env/time.c + bugs + suggested patch

Chris Matrakidis <[email protected]>
Newsgroups gmane.comp.gnu.glpk
Message-ID <CAEaJ3S64fWCx2x48JkXBNiFMj9XctXT-6CQ_Zh6XyVb0+1qNNQ@mail.gmail.com>
Hi Andrew,

> Not sure, but gmtime_s looks like a MSVC function. Could you point me
> out where gmtime_s is standardized? Thanks.

gmtime_s is included in the (optional) annex K of C11. However, the
parameters are reversed compared to the MSVC version and the standard
one returns struct tm * while the MSVC one returns errno_t.

Moreover, some searching shows that gmtime_s is documented starting
with VS 2010 (and _gmtime_s in VS 2005 and VS 2008). However, since VS
2005 gmtime returns a different pointer per thread [1], so there is no
reason to use gmtime_s here - gmtime_s offers additional error
checking for null pointers, which is not an issue in this code.


Best Regards,

Chris Matrakidis

[1] https://msdn.microsoft.com/en-us/library/0z9czt0w(v=vs.80).aspx
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.