Sys.setenv(TZ="Etc/GMT+8") will use standard time only for time calculations.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

"Folkes, Michael" <Michael.Folkes@dfo-mpo.gc.ca> wrote:

Hello all,
After beating my head against the wall for a few hours, I give up.
I have two problems.
1. If I use seq() to generate a POSIXct series that crosses a daylight savings to stardard time change I get two values for the first day of change. The time change is Nov 6,2011. The value for Nov 7 turns into 23:00 on Nov 6, thus two values for Nov 6. (see below)
So I put a time value (noon) into the sequence, that did give me a correct date sequence.

2. When using that modified date sequence in maptools::sunriset(), on day of change to stardard time the sunrise time is shifted by one hour. (i.e. Nov5 8am, Nov6 6am, Nov7 7am)
I can't fathom why sunriset() is giving me funny results on the day of time change. I wonder if there is something amiss with how my windows XP is managing time zones perhaps? I would have expected sunriset() to be using just the day value from its dateTime argument, not the time component? 
thanks!
Michael

__________________________

start <- as.POSIXct("2011-11-05")
end <- as.POSIXct("2011-11-07")
date.ser<-seq(start,end,by='day')
# time change is Nov 6,2011
date.ser
##### Two values for Nov 6 as Nov 7th lost an hour.
[1] "2011-11-05 00:00:00 PDT" "2011-11-06 00:00:00 PDT"
[3] "2011-11-06 23:00:00 PST"


### Add noon to correct flexibility for time shift.
start <- as.POSIXct("2011-11-05 12:00:00")
end <- as.POSIXct("2011-11-07 12:00:00")
date.ser<-seq(start,end,by='day')
date.ser
[1] "2011-11-05 12:00:00 PDT" "2011-11-06 11:00:00 PST"
[3] "2011-11-07 11:00:00 PST"

library(maptools)
nanaimo <- matrix(c(-123+(-57/60),49+11/60), nrow=1)
sunriset(nanaimo, date.ser, direction="sunrise", POSIXct.out=T)[,2]
[1] "2011-11-05 08:09:42 PDT" "2011-11-06 06:11:19 PST"
[3] "2011-11-07 07:12:56 PST"

_____________________________________________

Michael Folkes
Salmon Stock Assessment
Canadian Dept. of Fisheries & Oceans 
Pacific Biological Station
3190 Hammond Bay Rd.
Nanaimo, B.C., Canada
V9T-6N7
Ph (250) 756-7264 Fax (250) 756-7053 Michael.Folkes@dfo-mpo.gc.ca


	[[alternative HTML version deleted]]

_____________________________________________

R-help@r-project.org 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.


	[[alternative HTML version deleted]]

