]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix years being offset from weeks (#1678).
authorMatt Schatz <genius3000@g3k.solutions>
Thu, 4 Jul 2019 16:30:23 +0000 (10:30 -0600)
committerPeter Powell <petpow@saberuk.com>
Thu, 4 Jul 2019 16:30:23 +0000 (17:30 +0100)
Currently a duration of 52w will return a blank string.
When I added weeks to the calculations, I failed to update
the number of seconds to a year. As 365 days and 52 weeks
aren't the same, but the calculation needs to be consistent.

src/helperfuncs.cpp

index 846feab5072fd21e7c6ad63b0da9f7ed5b56fa94..386d6dafc62a4c2ed83a27299b6dec3611ebc7cb 100644 (file)
@@ -432,7 +432,7 @@ bool InspIRCd::IsValidDuration(const std::string& duration)
 
 std::string InspIRCd::DurationString(time_t duration)
 {
-       time_t years = duration / 31536000;
+       time_t years = duration / 31449600;
        time_t weeks = (duration / 604800) % 52;
        time_t days = (duration / 86400) % 7;
        time_t hours = (duration / 3600) % 24;