From gmbecker at ucdavis.edu  Mon Dec  7 22:23:17 2015
From: gmbecker at ucdavis.edu (Gabriel Becker)
Date: Mon, 7 Dec 2015 13:23:17 -0800
Subject: [Rd] inconsistency in POSIXlt
In-Reply-To: <CALxY2Lc1vNT_92fHid7bPmLyd-twYrjRbfBqV6xf7=WctW=omw@mail.gmail.com>
References: <CALxY2Lc1vNT_92fHid7bPmLyd-twYrjRbfBqV6xf7=WctW=omw@mail.gmail.com>
Message-ID: <CADwqtCNMA6VS0u7si5SwpHVEF_Jm7N-EZDAYQmLqzOximthsZA@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]]



[Rd] inconsistency in POSIXlt
Gabriel Becker