Re: [R] Time zones in POSIClt objects

2024-10-11 Thread Jan van der Laan
On 10/11/24 11:56, Rui Barradas wrote: Hello, A way to have different time zones is to store t1 and t2 in list, which are vectors. Just not atomic vectors. I think it complicates what should be simple, but here it is. # create two lists t1 <- lapply(c("2024-01-01 12:30", "2024-01-01 12:30

Re: [R] Time zones in POSIClt objects

2024-10-11 Thread Jan van der Laan
Thanks, On 10/11/24 09:10, Ivan Krylov wrote: В Thu, 10 Oct 2024 17:16:52 +0200 Jan van der Laan пишет: This is where it is unclear to me what the purpose is of the `zone` element of the POSIXlt object. It does allow for registering a time zone per element. It just seems to be ignored. I thi

Re: [R] Time zones in POSIClt objects

2024-10-11 Thread Rui Barradas
Às 15:13 de 10/10/2024, Jeff Newmiller via R-help escreveu: POSIXt vectors do not support different time zones element-to-element. If you want to keep track of timezones per element, you have to create a vector of timestamps (I would recommend POSIXct using UTC) and a parallel vector of timezo

Re: [R] Time zones in POSIClt objects

2024-10-11 Thread Ivan Krylov via R-help
В Thu, 10 Oct 2024 17:16:52 +0200 Jan van der Laan пишет: > This is where it is unclear to me what the purpose is of the `zone` > element of the POSIXlt object. It does allow for registering a time > zone per element. It just seems to be ignored. I think that since POSIXlt is an interface to wh

Re: [R] Time zones in POSIClt objects

2024-10-10 Thread Jeff Newmiller via R-help
I am not sure what this has to do with timezones embedded in specific POSIXt vectors? Can you elaborate why this is relevant? On October 10, 2024 11:32:31 AM PDT, Gabor Grothendieck wrote: >Sys.setenv(TZ = "GMT") will set the local time zone to GMT so there >would only be one time >zone regardl

Re: [R] Time zones in POSIClt objects

2024-10-10 Thread Gabor Grothendieck
Sys.setenv(TZ = "GMT") will set the local time zone to GMT so there would only be one time zone regardless of whether local or GMT were used. On Thu, Oct 10, 2024 at 11:17 AM Jan van der Laan wrote: > > Thanks. > > On 10/10/24 16:13, Jeff Newmiller wrote: > > POSIXt vectors do not support differe

Re: [R] Time zones in POSIClt objects

2024-10-10 Thread Jan van der Laan
Thanks. On 10/10/24 16:13, Jeff Newmiller wrote: POSIXt vectors do not support different time zones element-to-element. > I complained about this on this list a couple of decades ago, and was chastised for it. Evidently handling timezones per element was considered to be too impractically s

Re: [R] Time zones in POSIClt objects

2024-10-10 Thread Jeff Newmiller via R-help
POSIXt vectors do not support different time zones element-to-element. If you want to keep track of timezones per element, you have to create a vector of timestamps (I would recommend POSIXct using UTC) and a parallel vector of timezone strings. How you manipulate these depends on your use cases

[R] Time zones in POSIClt objects

2024-10-10 Thread Jan van der Laan
It is not completely clear to me how time zones work with POSIXlt objects. For POSIXct, I can understand what happens: time is always stored in GMT, the `tzone` attribute only affects how the times are displayed. All computations etc. are done in GMT. POSIXlt objects have both a `tzone` att