Skip to content
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

Time unit for year is wrong. There are 365 or 366 days in a normal year, not 7 * 52 = 364 #78

Open
hepr-skylotec opened this issue Jan 17, 2025 · 0 comments

Comments

@hepr-skylotec
Copy link

In init.py time_units are defined as follows:

time_units = (dict(divider=1e-9, singular='nanosecond', plural='nanoseconds', abbreviations=['ns']),
              dict(divider=1e-6, singular='microsecond', plural='microseconds', abbreviations=['us']),
              dict(divider=1e-3, singular='millisecond', plural='milliseconds', abbreviations=['ms']),
              dict(divider=1, singular='second', plural='seconds', abbreviations=['s', 'sec', 'secs']),
              dict(divider=60, singular='minute', plural='minutes', abbreviations=['m', 'min', 'mins']),
              dict(divider=60 * 60, singular='hour', plural='hours', abbreviations=['h']),
              dict(divider=60 * 60 * 24, singular='day', plural='days', abbreviations=['d']),
              dict(divider=60 * 60 * 24 * 7, singular='week', plural='weeks', abbreviations=['w']),
              **dict(divider=60 * 60 * 24 * 7 * 52, singular='year', plural='years', abbreviations=['y']))**

The divider for year is obviously wrong, as the number of days in a year are 365 (366 for leap years), and 7*52 = 364. This means that any calculation that depends on the year will be off by at least one day per year.

Fix by changing
60 * 60 * 24 * 7 * 52 to 60 * 60 * 24 * 365 on line 88 in init.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant