-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
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
AlexeyDemidov
Metadata
Metadata
Assignees
Labels
No labels