Skip to content

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

Description

@hepr-skylotec

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions