[Rd] Revisit c.POSIXlt , [<-.POSIXlt , [[<-.POSIXlt ?

Suharto Anggono Suharto Anggono @uh@rto_@nggono @end|ng |rom y@hoo@com
Tue Jun 16 10:59:37 CEST 2026


 In 'c.POSIXlt', because 'floor' has been applied first, the final correction,
 x$sec[i] <- floor(x$sec[i]) + s[i]
, doesn't need 'floor' anymore, although 'floor' doesn't harm.

_______
On Tuesday, 16 June 2026 at 02:48:39 pm GMT+7, Suharto Anggono Suharto Anggono <suharto_anggono using yahoo.com> wrote:


Isn't the NEWS item too condensed?

On 'c.POSIXlt', the part from "Changes in R-devel" can be taken over:
c(x) could become one second ahead of x in R 4.6.0

On '[<-.POSIXlt' and '[[<-.POSIXlt', the following can be stated:
x[i] <- val and x[[i]] <- val now also works as intended for POSIXlt object 'x' without "tzone" attribute.
Or:
For POSIXlt object 'x' without "tzone" attribute, x[i] <- val and x[[i]] <- val now works and converts 'val' as intended.
Or:
In R 4.6.0, if 'x' is a POSIXlt object without "tzone" attribute and 'val' is not a POSIXlt object without "tzone" attribute, x[i] <- val and x[[i]] <- val failed or didn't convert 'va' to current time zone.

______
On Tuesday, 16 June 2026 at 06:25:42 am GMT+7, Martin Maechler <maechler using stat.math.ethz.ch> wrote:


>>>>> Martin Maechler
>>>>>    on Mon, 15 Jun 2026 18:08:43 +0200 writes:

>>>>> Suharto Anggono Suharto Anggono
>>>>>    on Sun, 14 Jun 2026 13:37:13 +0000 (UTC) writes:

    >> Could at least a minimalistic fix be put for the upcoming R 4.6.1? For example:
    >> ln '[<-.POSIXlt' and '[[<-.POSIXlt', change
    >>     else as.POSIXlt(as.POSIXct(value), tz = tz[1L]))
    >> to
    >>     else as.POSIXlt(as.POSIXct(value), tz = if(is.null(tz)) "" else tz[1L]))

    >> In 'c.POSIXlt', apply 'floor' to the 'sec' component before converting to POSIXct like in Bug 18989 Comment 9 (https://bugs.r-project.org/show_bug.cgi?id=18989#c9).


    > Yes, this *could* be done, last minute, i.e., fixing some bugs
    > in POSIXlt <--> POSIXct  handling.

    > I've tried in my local copy of  "R 4.6.1 beta".

    > and indeed, these minimal patches already fix the two problems
    > you mention below (and I've marked with  '1.'  and '2.' ).

    > *However* your wish is rather late (we have code freeze in 1.5 days and
    > should only fix somewhat urgent problems with small fixes),
    > *and* the two problematic examples below are not new bugs, they
    > do "not work" already in 4.4.x (I tried one) and 4.5.0, .. 4.5.3, etc

    > Whereas your proposed changes *are* nicely small and look
    > sensible, the bugs (below) have been in R for a while now *and*
    > are fixed in R-devel (already with svn r89926 I think).

    > So I don't know if there is anybody (but you ;-) who'd be very
    > happy for such a late bug fix.

    > Other opinions -- notably R core / Release Manager ?

    > Thank you in any case, for the suggestion, and the effort to
    > find such a minimal (informal) patch.

    > Best regards,
    > Martin


I've decided to commit these -- together with the
as.matrix(<POSIXlt>)  bug fix, ported from R-devel.

So these should make into R 4.6.1  next week.

Best regards,
Martin  
	[[alternative HTML version deleted]]



More information about the R-devel mailing list