-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document expected behavior on Daylight Saving Time (DST) clock changes #193
Comments
The database tracks local time without information about the timezone. As a result, if the used timezone follows DST then vnStat still doesn't need to really be aware of it. If local time skips forward one hour then that hour will not be recorded as it didn't exist from the daemon point of view. If the local time jumps backward one hour then that will result in the ongoing hour getting repeated and vnStat will add any new traffic on top of the time period that hour had previously seen. This same applies to the 5 minute resolution data. The daemon keeps track of those 5 minute entries regardless of what the database write interval is (and that's one reason why the This same principle obviously also applies if you'd, for example, have a laptop you travel with and change the timezone of the system to match the local timezone. The change doesn't need to be DST induced. |
Okay, so the database will not have duplicate entries. But it will add new traffic to existing traffic. So if there was a constant 100MB of traffic every hour overnight, the database will record
and if someone happens to pull data sometime between 1am and 2am after the clock moved back, it would report some value between 100MB and 200MB as data is accumulating. Thanks |
The sqlite database used in the vnStat 2.x versions can't have duplicate entries due to the database schema and how the data is being written in. The numbers in your example are correct. |
Thank you, that makes life easy as apps that pull JSON or XML will not have to worry about duplicate timestamps, and no data is being lost from the count. I think it would be good to document this in the man page.... or just let this issue suffice as the documentation, your call. Thanks |
I haven't yet decided which location should be best for documenting this, most likely either the When searching for documentation about how vnStat handles timezones, which documentation sources did you read and in what order? Was there any particular keyword you were looking for? |
I would search for DST or Daylight Savings Time and I would probably look in the section of man page that describes output from JSON or XML as that is where someone that needs to know this info would likely be looking. But it could just as easily go at the end of the man page (maybe between examples and restrictions) as a database notes section for example. David |
Humm... sorry to day but your documentation wouldn't really have helped me. The problem is not really timezone changes, the problem is DST, I suggest explicitly addressing behavior when DST or Daylight Savings Time changes occur, those are the relevant keywords, not timezone and neither appear in the updated documentation. |
Clocks moved forward one hour for Daylight Savings Time (DST) in the United States today at 2am local time. Observing behavior of vnstat and what is logged in the database I see that there is no data for 02:00 to 02:59. Put another way... for hourly reports there will be 23 entries for today, 2021-03-14. This is what I was expecting.
But this is not documented (as far as I can see) and I am wondering what to expect for when the clocks move back at 2am local time on November 7th (to 1am local time). Will the database record two entries for the period 01:00 to 01:59 that day. Or put another way, 25 hourly entries one of which will have duplicate timestamp of 01:00 hrs. Or will vnstat combine the traffic for a 2-hour period into a single database record? And if vnstat is recording to the database every 10 or 20 minutes, what will that record for the overlap period? And what about 5-minute entries?
I am reading JSON from the db and It would be really helpful to have this documented... so I can anticipate what will happen when DST ends.
Thank you.
The text was updated successfully, but these errors were encountered: