Trivial nit: Idle time doesn't account for Daylight'Standard time transition

mkolowich 7 years ago updated by bampton 2 years ago 3

This is a trivial thing (i.e. I wouldn't expect it necessarily to be fixed), but just an observation: the transition from Standard to Daylight time means that idle time was not calculated properly. That is, an idle period from midnight to 6:35am was displayed as 6hr35min, when it was, in fact, 5hr35min (we lost an hour overnight). I don't know whether there are any rate calculations that might have been similarly affected, but it's worth noting.

Image 9

On the other hand, I was impressed that the API and TeslaFi app picked up the time change instantaneously:

Image 10

Related issue- I was on the road driving when DST ended (2021-11-07 EDT/EST USA). My 2 hour trip was clocked as only taking one hour. The code looks to be partially correct in that the speed for the trip was correct instead of being 2x the actual speed (I assume there is a time_t difference for the MPH code [ending odometer - starting odometer / time_t ending time - time_t starting time], but the timezone's datestamp was used in the duration calcs [might be a similar corner case which traveling between timezones that one should check while addressing this bug?]). Could also be a but in whatever libary you are using for date math if you didn't roll your own.

I'm not sure how to correctly report this to the end user as the start and end times are correct, it is just the date math returns the wrong result (and unlike the occasional leap second, the error is significant). Is it practical to have "* DST ended/stopped during this event" footnote somewhere? Today, sure I'll recall the error is DST to ST. Next year, not so much.


Thanks. I thought I had fixed this on the backend of the server last year but I guess not.

I did some more research and it looks like I have to upgrade the php version since DST in DateTime:diff is considered a bug in the current version I'm running.

I'm going to move this to a feature request so I can spend more time on it later. I'll have to do some testing to make sure the php upgrade doesn't 'break' anything.

Under review