This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strptime error when setting a different TimeZone with export TZ=UTC


> 
> Actually tm_mon must be in the range [0,11].  You might have been
> thinking of tm_mday which unlike all the others is 1-based, [1,31]. 

You got me, and I even had the POSIX spec open in front of me when
I read the wrong line as to which field was 1-based. :)

 In
> this particular example though it's probably sufficient to initialize tm
> with { 0 } since both tm_mday and tm_mon should be filled in by strptime
> on success.  However, to truly be correct you'd have to check not only
> that strptime didn't return NULL, but that it parsed the entire format
> string and stopped at the expected point rather than failing early.

Isn't portable programming fun?

--
Eric Blake



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]