From 47af43c2810224ff0f101f8d0ed160100fae6896 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 30 Jan 2013 11:24:57 -0500 Subject: [PATCH] Made Anope::Duration also show years --- src/misc.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/misc.cpp b/src/misc.cpp index 957410656..18d737dbc 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -267,6 +267,7 @@ time_t Anope::DoTime(const Anope::string &s) Anope::string Anope::Duration(time_t t, const NickCore *nc) { /* We first calculate everything */ + time_t years = t / 31536000; time_t days = (t / 86400); time_t hours = (t / 3600) % 24; time_t minutes = (t / 60) % 60; @@ -278,8 +279,14 @@ Anope::string Anope::Duration(time_t t, const NickCore *nc) { bool need_comma = false; Anope::string buffer; + if (years) + { + buffer = stringify(years) + " " + (years != 1 ? Language::Translate(nc, _("years")) : Language::Translate(nc, _("year"))); + need_comma = true; + } if (days) { + buffer += need_comma ? ", " : ""; buffer = stringify(days) + " " + (days != 1 ? Language::Translate(nc, _("days")) : Language::Translate(nc, _("day"))); need_comma = true; }