[Rd] strptime bug (PR#1155)
ripley@stats.ox.ac.uk
ripley@stats.ox.ac.uk
Wed, 31 Oct 2001 12:38:07 +0100 (MET)
On 31 Oct 2001, Peter Dalgaard BSA wrote:
> ripley@stats.ox.ac.uk writes:
>
> > > ## The beav1 example in *help[R](plot.POSIXct)* shows two bugs.
> > > ## The first is a fundamental error in strptime.
> >
> > In your OS's implementation of strptime, not the R code ....
> ...
> > It would be helpful to give the incorrect output that your system gives.
> > In the output below I see no evidence of `the times wrap'. Using the
> > wrong day seems to be a bug in glibc's strptime, but you need to unclass
> > the strptime result to see this. (I do see the strptime bug on RH6.2
> > Linux, where the day field is ignored.)
>
> RH7.1 too.
I've located the problem, which boils down to inaccuracies in the
following in man strptime:
The GNU libc implementation does not touch those fields
which are not directly initialized. Exceptions are the
tm_wday and tm_yday elements which are recomputed if any
of the year, month, or date elements changed.
As RMH's example shows, it does touch the tm_mon and tm_mday fields if the
year is specified (even if unchanged) but not quite always.
I am writing a workaround for R-devel. Yet another system-specific
problem with the date-time code!
Brian
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._