Error? durationToDays

Tage = 91 (13 Weeks)
Result of durationToDays is 90...

What went wrong?

You need to go to the next day for your end instant

1 Like

Thank you, but look at this:


Result = 90 !!


Result = 3

Use millesecond instants instead, then you can use the maths blocks and divide by 86,400,000

image

An interesting question ...

How can the Duration between two days lead to a non-integral number of days, measured in milliseconds?

Proof:
bug_farm.aia (16.0 KB)

In financial programming, we are warned against salami truncation of fractional pennies, where monetary crumbs are swept into a crooked programmer's account unnoticed.
So THAT's where all that lost time has been going!

The remainder of the division by ms per day is looking too round for this to be a floating point division error:


(draggable)

A little integer math leads me to a single missing hour:

Thanks to everybody!
I will try the "ms example" (getDays)

I don't have a good answer for this problem yet.

The one hour difference suggests to me that this might have something to do with Daylight Savings Time .

1 Like

Is a system / algorithm recognizable? At least not at first sight.

...

It seems to have something to do with daylight saving time. If I set 1970 or 1972 as the year, the problems don't arise.

Yeah, I missed your post.