tvkitchen / appliances

A one stop shop for official TV Kitchen Appliances
GNU Lesser General Public License v3.0
3 stars 0 forks source link

Segment positions are wrong with non-zero origin position #93

Closed slifty closed 3 years ago

slifty commented 3 years ago

Bug

Current Behavior

If the calculated originPosition is not zero the timestamps of periods are incorrect.

This is because the originPosition is not added in the periodPosition (wasn't a problem if originPosition was zero!)

To fix this we should update getPeriodPosition so that Math.floor((position - originPosition) / interval) * interval is replaced with Math.floor((position - originPosition) / interval) * interval + originPosition