Skip to content
Back to formatted view

Raw Message

Message-ID: <CADwqtCNMA6VS0u7si5SwpHVEF_Jm7N-EZDAYQmLqzOximthsZA@mail.gmail.com>
Date: 2015-12-07T21:23:17Z
From: Gabriel Becker
Subject: inconsistency in POSIXlt
In-Reply-To: <CALxY2Lc1vNT_92fHid7bPmLyd-twYrjRbfBqV6xf7=WctW=omw@mail.gmail.com>

David,

I didn't have time to dig through the code completely, but those other two
are being set automatically in the C code as far as I can tell, in
particular in the code

    // localtime may change tzname.
    if (isgmt) {
	PROTECT(tzone = mkString(tz));
    } else {
	PROTECT(tzone = allocVector(STRSXP, 3));
	SET_STRING_ELT(tzone, 0, mkChar(tz));
	SET_STRING_ELT(tzone, 1, mkChar(R_tzname[0]));
	SET_STRING_ELT(tzone, 2, mkChar(R_tzname[1]));
    }


In the file https://svn.r-project.org/R/trunk/src/main/datetime.c
(function do_asPOSIXlt)

R_tzname is an extern char pointer. I can't say exactly where it is
populated, but the code assumes it will be and that it will take care
of what passing a length 3 vector would.

Also, note that AFAICT the second and third are not freeform text,
only very specific values are valid.

Long story short, I think the answer is R doesn't let you do that
because it takes care of it for you. (Unless someone more familiar
with date handling in R pops in and points out how I've completely
missed something).

Best,

~G


-- 
Gabriel Becker, PhD
Associate Scientist (Bioinformatics)
Genentech Research

	[[alternative HTML version deleted]]