Sys.setenv(TZ="Etc/GMT+5")

Make the timezone you prefer the default for that R session.

FWIW: EST may or may not exist as a valid timezone on your system, but it is an ambiguous notation anyway.
---------------------------------------------------------------------------
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.

Denis Chabot <chabot.denis@gmail.com> wrote:

Hi,

For a project I try to keep everything in normal time, not daylight saving time, to prevent problem when instruments collected data during the nights when we go from DST to normal time.

But sometimes R tricks me and I do not know how to prevent it.

This is one example:

lights_on = as.POSIXct(c("2011-05-06 04:09:26", "2011-05-07 04:07:53", "2011-05-08 04:06:21",
"2011-05-09 04:04:51", "2011-05-10 04:03:22", "2011-05-11 04:01:55",
"2011-05-12 04:00:30", "2011-05-13 03:59:06", "2011-05-14 03:57:45",
"2011-05-15 03:56:25", "2011-05-16 03:55:07"), tz="EST") # not DST

lights_off = as.POSIXct(c("2011-05-05 18:56:54", "2011-05-06 18:58:19", "2011-05-07 18:59:44",
"2011-05-08 19:01:08", "2011-05-09 19:02:32", "2011-05-10 19:03:55",
"2011-05-11 19:05:18", "2011-05-12 19:06:40", "2011-05-13 19:08:01",
"2011-05-14 19:09:22", "2011-05-15 19:10:42" ), tz="EST")	# not DST

(a = lights_on[c(1,5)])	# not DST
[1] "2011-05-06 04:09:26 EST" "2011-05-10 04:03:22 EST"

(b = lights_off[c(2,6)])	# not DST
[1] "2011-05-06 18:58:19 EST" "2011-05-10 19:03:55 EST"

(x = c(lights_off[2], lights_on[2])) # suddenly DST
[1] "2011-05-06 19:58:19 EDT" "2011-05-07 05:07:53 EDT"

Why did x end up in DST? How could I prevent it?

Thanks in advance,

Denis
_____________________________________________

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]]

