diff options
Diffstat (limited to 'src/misc.cpp')
-rw-r--r-- | src/misc.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/misc.cpp b/src/misc.cpp index 3f74888ee..18d737dbc 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -1,6 +1,6 @@ /* Miscellaneous routines. * - * (C) 2003-2012 Anope Team + * (C) 2003-2013 Anope Team * Contact us at team@anope.org * * Please read COPYING and README for further details. @@ -123,8 +123,6 @@ bool ListFormatter::IsEmpty() const void ListFormatter::Process(std::vector<Anope::string> &buffer) { - buffer.clear(); - std::map<Anope::string, size_t> lenghts; std::set<Anope::string> breaks; for (unsigned i = 0; i < this->columns.size(); ++i) @@ -234,7 +232,7 @@ time_t Anope::DoTime(const Anope::string &s) if (s.empty()) return -1; - int amount; + int amount = 0; Anope::string end; try @@ -263,12 +261,13 @@ time_t Anope::DoTime(const Anope::string &s) } catch (const ConvertException &) { } - return 0; + return amount; } 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; @@ -280,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; } @@ -582,7 +587,23 @@ Anope::string Anope::VersionShort() Anope::string Anope::VersionBuildString() { - return "build #" + stringify(BUILD) + ", compiled " + Anope::compiled; + Anope::string s = "build #" + stringify(BUILD) + ", compiled " + Anope::compiled; + Anope::string flags; + +#ifdef DEBUG_BUILD + flags += "D"; +#endif +#ifdef VERSION_GIT + flags += "G"; +#endif +#ifdef _WIN32 + flags += "W"; +#endif + + if (!flags.empty()) + s += ", flags " + flags; + + return s; } int Anope::VersionMajor() { return VERSION_MAJOR; } |