I essence my data fields are a date and a corresponding meter value. Unfortunately the meter only allows for 4 digits, so sooner or later it will overflow. The aim is to calculate
average use over an extended period of time. Is there any best practice to store and handle this kind of data?
If I just store the meter's face value, then the application has to scan sequentially all data to know how many overflows occurred during the interval in order to perform the desired calculation.
If on the other hand, through a data entry interface, I store the adjusted difference between to readings, then I have to sum all values for that interval.
There seems to be no free lunch?
PS: for some meters, the problem gets more complicated because they are battery fed. If the battery is replaced they restart at zero. For these I can not assume that when they go from 7543 to 123 they actually went from 7543 to 9999 and then to 123.