diff options
author | McCabe Maxsted | 2011-04-11 21:15:29 -0700 |
---|---|---|
committer | McCabe Maxsted | 2011-04-11 21:15:29 -0700 |
commit | d060c9badbe3c5babd13db6f82848fcf5033ce89 (patch) | |
tree | daf3e6d5dfb0b41cd4e221d84702ec569254938a /linden/indra | |
parent | Tidied up the layout of the right click text menu (diff) | |
download | meta-impy-d060c9badbe3c5babd13db6f82848fcf5033ce89.zip meta-impy-d060c9badbe3c5babd13db6f82848fcf5033ce89.tar.gz meta-impy-d060c9badbe3c5babd13db6f82848fcf5033ce89.tar.bz2 meta-impy-d060c9badbe3c5babd13db6f82848fcf5033ce89.tar.xz |
Fixed avatar ages showing up as -1 days old for people on different timezones
Diffstat (limited to 'linden/indra')
-rw-r--r-- | linden/indra/newview/llpanelavatar.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/linden/indra/newview/llpanelavatar.cpp b/linden/indra/newview/llpanelavatar.cpp index 6b3be29..d924009 100644 --- a/linden/indra/newview/llpanelavatar.cpp +++ b/linden/indra/newview/llpanelavatar.cpp | |||
@@ -1953,9 +1953,9 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) | |||
1953 | self->mPanelSecondLife->childSetValue("acct", caption_text); | 1953 | self->mPanelSecondLife->childSetValue("acct", caption_text); |
1954 | 1954 | ||
1955 | //Chalice - Show avatar age in days. | 1955 | //Chalice - Show avatar age in days. |
1956 | int year; | 1956 | S32 year; |
1957 | int month; | 1957 | S32 month; |
1958 | int day; | 1958 | S32 day; |
1959 | sscanf(born_on.c_str(), "%d/%d/%d", &month, &day, &year); | 1959 | sscanf(born_on.c_str(), "%d/%d/%d", &month, &day, &year); |
1960 | time_t now = time(NULL); | 1960 | time_t now = time(NULL); |
1961 | struct tm * timeinfo; | 1961 | struct tm * timeinfo; |
@@ -1964,8 +1964,11 @@ void LLPanelAvatar::processAvatarPropertiesReply(LLMessageSystem *msg, void**) | |||
1964 | timeinfo->tm_year = year - 1900; | 1964 | timeinfo->tm_year = year - 1900; |
1965 | timeinfo->tm_mday = day; | 1965 | timeinfo->tm_mday = day; |
1966 | time_t birth = mktime(timeinfo); | 1966 | time_t birth = mktime(timeinfo); |
1967 | |||
1967 | std::stringstream numberString; | 1968 | std::stringstream numberString; |
1968 | numberString << (S32)(difftime(now, birth) / 86400); //(60*60*24) | 1969 | S32 days = difftime(now, birth) / 86400; //(60*60*24) |
1970 | if (days < 0) days = 0; // Happens for people on different timezones -- MC | ||
1971 | numberString << days; | ||
1969 | 1972 | ||
1970 | LLStringUtil::format_map_t targs; | 1973 | LLStringUtil::format_map_t targs; |
1971 | targs["[DAYS]"] = numberString.str(); | 1974 | targs["[DAYS]"] = numberString.str(); |