[Rd] format.POSIXlt drops characters following percent sign (PR#8975)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Jun 13 21:38:03 CEST 2006
On Tue, 13 Jun 2006, jhallman at frb.gov wrote:
> Full_Name: Jeff Hallman
> Version: 2.3.1
> OS: Windows
> Submission from: (NULL) (132.200.32.34)
>
>
> Internal(format.POSIXlt(as.POSIXlt(Sys.time()), "%Y%m%d%q", F))
> Linux R-2.2.1 returns "20060613%q".
> Windows R-2.3.1 returns "20060613" dropping the "%q".
There is no such command as Internal: you seem to be mean .Internal but
please use user-level functions.
> The documentation says "Any character in the format string other that
> the '%' escape sequences is interpreted literally". Since "%q" is
> nowhere listed as an escape sequence, the Windows R-2.3.1 result appears
> to be incorrect.
What the help page actually says is (no typo):
The details of the formats are system-specific, but the following
are defined by the ISO C / POSIX standard for 'strftime' and are
likely to be widely available. Any character in the format string
other than the '%' escape sequences is interpreted literally (and
'%%' gives '%').
The help page carefully does not say what *any* escape sequence does, nor
what the escape sequences are: it merely indicates common behaviour.
It seems you did not look up what the standards say, which is
If a conversion specification does not correspond to any of the above,
the behavior is undefined.
And `undefined' is itself defined in the standards. The Windows
documentation does not say what it does (nor does the glibc
documentation), not even that it is system-specific. In fact the MSDN
docs for strftime say
Characters that do not begin with % are copied unchanged to strDest.
(Make of that what you can.)
Where standards are referred to, please do consult them. The kind people
who develop R have even provided links to them at
http://developer.r-project.org/Portability.html
--
Brian D. Ripley, ripley at 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 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list