Re: [R] POSIXct time zone and daylight savings issues

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue 31 Oct 2006 - 09:24:02 GMT

On Mon, 30 Oct 2006, Sebastian P. Luque wrote:

> Hi again,
>
> A related issue I can't quite understand is:
>
>
> R> tt <- as.POSIXct("2006-05-24", tz="EEST")
> R> tt
> [1] "2006-05-24 EEST"
> R> seq(tt, length=12, by="months")
> [1] "2006-05-24 EEST" "2006-06-24 EEST" "2006-07-24 EEST" "2006-08-24 EEST"
> [5] "2006-09-24 EEST" "2006-10-24 EEST" "2006-11-24 EEST" "2006-12-24 EEST"
> [9] "2007-01-24 EEST" "2007-02-24 EEST" "2007-03-24 EEST" "2007-04-24 EEST"
> R> tt <- as.POSIXct("2006-05-24", tz="EET")
> R> seq(tt, length=12, by="months")
> [1] "2006-05-24 EEST" "2006-06-24 EEST" "2006-07-24 EEST" "2006-08-24 EEST"
> [5] "2006-09-24 EEST" "2006-10-24 EEST" "2006-11-24 EET" "2006-12-24 EET"
> [9] "2007-01-24 EET" "2007-02-24 EET" "2007-03-24 EET" "2007-04-24 EEST"
> R> sessionInfo()
> R version 2.4.0 (2006-10-03)
> x86_64-pc-linux-gnu
>
> locale:
> LC_CTYPE=en_CA.UTF-8;LC_NUMERIC=C;LC_TIME=en_CA.UTF-8;LC_COLLATE=en_CA.UTF-8;LC_MONETARY=en_CA.UTF-8;LC_MESSAGES=en_CA.UTF-8;LC_PAPER=en_CA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_CA.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
> [7] "base"
>
> other attached packages:
> lattice
> "0.14-9"
>
>
> i.e. daylight savings 'tzone' attribute gets adjusted automatically when
> providing the standard time attribute, but not when providing the daylight
> savings time. Does this behaviour depend on the OS/locale? Should the
> 'tz' argument supplied when creating POSIXct objects always be the
> standard time version?

No, it should be a timezone, and the timezone specification includes when DST is in effect. See ?as.POSIXct for details and references of timezones. For example, EST is a timezone without DST and EST5EDT is a timezone with DST (and they agree in winter). It looks like Linux is interpreting EEST as UTC+3 throughout the year (which appears not to be used anywhere as an actual timezone). So the behaviour is clear: EEST does not have DST, and $isdst == 0 in that 'timezone', whereas EET does have DST.

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue Oct 31 20:30:00 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 31 Oct 2006 - 17:30:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.