Monthly accounting starts tracking quota one day early
Summary
When bandwidth accounting is set to monthly, and the start day is set to the first of the month, bandwidth tracking begins its calculations one day early. It ends up counting the entire current month plus the last day of the previous month towards this month's quota:
From the log: Oct 26 00:00:01.000 [notice] Configured hibernation. This interval begins at 2024-09-30 00:00:00 and ends at 2024-11-01 00:00:00. We have no prior estimate for bandwidth, so we will start out awake and hibernate when we exhaust our quota.
Steps to reproduce:
- Set torrc accounting to monthly with: AccountingStart month 1 00:00
- Start tor, observe the timestamp of the hibernation/quta period in the notice log.
What is the current bug behavior?
Hibernation quota accounting period begins at 00:00 on the last day of the previous month.
What is the expected behavior?
Hibernation period should begin at 00:00 the first day of the current month.
Environment
- Tor version 0.4.8.13 compiled from source tarball:
./configure --prefix=/usr --enable-gpl --enable-zstd --enable-systemd
- Debian GNU/Linux 12.7
- Compiled from source tarball
- Local timezone set to UTC on machine where behaviour was observed
Relevant logs and/or screenshots
Oct 26 00:00:01.000 [notice] Configured hibernation. This interval begins at 2024-09-30 00:00:00 and ends at 2024-11-01 00:00:00. We have no prior estimate for bandwidth, so we will start out awake and hibernate when we exhaust our quota.