diff options
author | James Cook <james@lindenlab.com> | 2010-04-20 16:06:25 -0700 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2010-04-20 16:06:25 -0700 |
commit | 257c3ed2a3747256500f704f6e06e7631af3c08e (patch) | |
tree | 7652d6a9844f23c32ee305d8d85e707224c7e332 | |
parent | 6d1e44b0338dd2815f605a5ba6e6528932cf3ebc (diff) |
LLDateUtil::ageFromDate() now takes more sensible parameters
This and last reviewed with Kelly
-rw-r--r-- | indra/newview/lldateutil.cpp | 15 | ||||
-rw-r--r-- | indra/newview/lldateutil.h | 2 | ||||
-rw-r--r-- | indra/newview/llfloateravatarpicker.cpp | 3 |
3 files changed, 9 insertions, 11 deletions
diff --git a/indra/newview/lldateutil.cpp b/indra/newview/lldateutil.cpp index 1a13cd05fd..32b8b9662a 100644 --- a/indra/newview/lldateutil.cpp +++ b/indra/newview/lldateutil.cpp @@ -59,8 +59,10 @@ static S32 days_from_month(S32 year, S32 month) } } -static std::string age_from_date(S32 born_year, S32 born_month, S32 born_day, - const LLDate& now) +std::string LLDateUtil::ageFromDate(S32 born_year, + S32 born_month, + S32 born_day, + const LLDate& now) { LLDate born_date; born_date.fromYMDHMS(born_year, born_month, born_day); @@ -158,7 +160,7 @@ std::string LLDateUtil::ageFromDate(const std::string& date_string, S32 born_month, born_day, born_year; S32 matched = sscanf(date_string.c_str(), "%d/%d/%d", &born_month, &born_day, &born_year); if (matched != 3) return "???"; - return age_from_date(born_year, born_month, born_day, now); + return ageFromDate(born_year, born_month, born_day, now); } std::string LLDateUtil::ageFromDate(const std::string& date_string) @@ -173,15 +175,10 @@ std::string LLDateUtil::ageFromDateISO(const std::string& date_string, S32 matched = sscanf(date_string.c_str(), "%d-%d-%d", &born_year, &born_month, &born_day); if (matched != 3) return "???"; - return age_from_date(born_year, born_month, born_day, now); + return ageFromDate(born_year, born_month, born_day, now); } std::string LLDateUtil::ageFromDateISO(const std::string& date_string) { return ageFromDateISO(date_string, LLDate::now()); } - -std::string LLDateUtil::ageFromDate(S32 year, S32 month, S32 day) -{ - return age_from_date(year, month, day, LLDate::now()); -} diff --git a/indra/newview/lldateutil.h b/indra/newview/lldateutil.h index 9c62241fe6..d72d8d1ed4 100644 --- a/indra/newview/lldateutil.h +++ b/indra/newview/lldateutil.h @@ -51,7 +51,7 @@ namespace LLDateUtil // Calls the above with LLDate::now() std::string ageFromDateISO(const std::string& date_string); - std::string ageFromDate(S32 year, S32 month, S32 day); + std::string ageFromDate(S32 born_year, S32 born_month, S32 born_day, const LLDate& now); } #endif diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 06070f876d..76567229d9 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -531,7 +531,8 @@ void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD& LLDate account_created = row["account_created"].asDate(); S32 year, month, day; account_created.split(&year, &month, &day); - std::string age = LLDateUtil::ageFromDate(year, month, day); + std::string age = + LLDateUtil::ageFromDate(year, month, day, LLDate::now()); columns[2]["column"] = "age"; columns[2]["value"] = age; search_results->addElement(item); |