Skip to content

strptime mysteriously adds a day - 0S-specific: Linux and (PR#1467)

2 messages · Brian Ripley, Göran Broström

#
On Thu, 18 Apr 2002, Martin Maechler wrote:

            
The issue is that an unspecified year is assumed *by the IS* to be 1900, a
leap year. I'm not sure why glibc does this when the tm_year field is not
being set, but it confidently says this is day 101 of the year, and that's
the result you get.

The only portable workaround is to give the year: there is (at least in
R-devel) a warning in the help file about this.
#
On Thu, 18 Apr 2002 ripley@stats.ox.ac.uk wrote:

            
Sorry, 1900 is not a leap year. Maybe glibc doesn't know that? :-)
However, 'cal 1900' (on Linux) gives a correct answer.
 
Göran