summaryrefslogtreecommitdiff
path: root/src/misc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc.cpp')
-rw-r--r--src/misc.cpp7
1 files changed, 7 insertions, 0 deletions
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;
}