-
Notifications
You must be signed in to change notification settings - Fork 125
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
Stats not rolling over on MonthRotate #87
Comments
|
Strange. So the condition for a reset of the monthly totaller is |
src/ifinfo.c (https://github.com/vergoh/vnstat/blob/master/src/ifinfo.c) starting from line 438 has the following condition:
|
I see the problem. So something like |
I don't think that change would work as expected. The original comparison is done against the system clock and the month stored in the database when the month previously changed. In order to get February displayed during January, some sort of offset would need to be introduced to the handling of that timestamp or system clock every time the current month is compared, which just isn't there currently. Most likely that sort of change would require modifications in more than just that single location. See for example the function |
Thanks for looking into it. If I have an idle moment I might have a closer look at the code. Meanwhile, I reset monthrotate to 1 yesterday so at least I am now on February. I realise that means if I change monthrotate back to 28 it won't rollover until 28 March. There may also be a problem with running on devices without a RTC if vnstat updates before a the system clock is syncronised. Or have you covered that? |
The daemon has a sanity check for the system time compared to the last known database update. In can be found from the datalist_timevalidation() function in src/daemon.c (https://github.com/vergoh/vnstat/blob/master/src/daemon.c) starting from line 457. It will cause any updates to be ignored if the last know database update is in the future. If the difference is more than one day then the daemon exists. There is some discussion related to this in pull request #85. Before you spend much time looking at the |
I installed vnstat 10 days ago and set MonthRotate to 28. Today, (30 Jan) it is still adding to January's total and hasn't started reporting February. I was expecting the monthly total to be reset at 00:00 28 January.
If it's relevant, 'Estimated' for January is showing 17x10^9 TiB.
The text was updated successfully, but these errors were encountered: