Dear Tommaso, This is not a bug. You asked for a difference of 1 day = 24 hours = 1440 minutes = 86400 seconds. And that is the difference you get.
> start <- as.POSIXct(strptime("20151025",format='%Y%m%d')) > end <- start + as.difftime(1, unit="days") > end - start Time difference of 1 days > as.integer(end) - as.integer(start) [1] 86400 Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance thierry.onkel...@inbo.be Havenlaan 88 bus 73, 1000 Brussel www.inbo.be /////////////////////////////////////////////////////////////////////////////////////////// To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey /////////////////////////////////////////////////////////////////////////////////////////// <https://www.inbo.be> Op wo 21 aug. 2019 om 08:25 schreef TOMMASO ADAMI <t.ad...@studenti.unibg.it >: > Hello, > > I would like to report this date/time bug that threatened me for a long > time, > as I need correct date calculation in my computations. > > If I add 1 day to the light saving switching day, it will incorrectly > subtract 1 hour from the date and missalign all my calculations. > > You can see it runing (I am testing it with Rome, Italy (+1) TimeZone) > > print(paste0("Horrible R Bug is present? > ",strptime("20151025",format='%Y%m%d')+as.difftime(1, unit="days"))); > > As you can see the output says 11pm and not 12pm ! > > I do not know if it is a requested feature, but for me is unpleasant and > unexpected behaviour. > > Thank you very much! > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel