Very slight inaccuracies in duration data

Have noticed a strange little one. Not sure if its a bug, or perhaps I’m misusing a formula or two (which as many here would attest, is not beyond me! :rofl: )

So take a look at this calendar. Look at the times presented. Some are on the hour, but many end times are a second early. All the data associated involves start times and durations, and all the durations are either a whole number of hours or half hours. (so for example 1.5 hrs)

What could be causing this?

Here’s example data in my table:

And here’s the cal

It’s a bug, an unfortunate floating point issue. Coda stores all dates and times as number of days since 1/1/1900 12 AM UTC, where hours are the decimal part. Same for durations: e.g. 1 hour is stored as ‭0,04166666666666666666666666666667‬ (1/24). When added to certain similarly not exact numbers (and more so in a binary system), there is a rounding error that results in that one second off.

To fix is to rewrite pretty much everything about dates on Coda side. I’m not sure why they went this way from the start tbh.

2 Likes

Oh great to know - thanks Paul. I’ll just grin an bare it for now.