From c6c90642739b5b482c6347ddb816789d23b6a3aa Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 30 Oct 2009 16:37:39 -0400 Subject: EXT-1565 Menu bar clock now shows Pacific (PDT/PST) time, as does any other UI widget that references "slt" in the XML. --- indra/llcommon/llstring.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'indra/llcommon/llstring.cpp') diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index f2edd5c559..721e5670e7 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -963,30 +963,29 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token, // if never fell into those two ifs above, param must be utc if (secFromEpoch < 0) secFromEpoch = 0; - LLDate * datetime = new LLDate((F64)secFromEpoch); + LLDate datetime((F64)secFromEpoch); std::string code = LLStringOps::getDatetimeCode (token); // special case to handle timezone if (code == "%Z") { if (param == "utc") + { replacement = "GMT"; - else if (param == "slt") - replacement = "SLT"; - else if (param != "local") // *TODO Vadim: not local? then what? + } + else if (param == "local") + { + replacement = ""; // user knows their own timezone + } + else + { + // "slt" = Second Life Time, which is deprecated. + // If not utc or user local time, fallback to Pacific time replacement = LLStringOps::getDaylightSavings() ? "PDT" : "PST"; - - return true; - } - replacement = datetime->toHTTPDateString(code); - - if (code.empty()) - { - return false; - } - else - { + } return true; } + replacement = datetime.toHTTPDateString(code); + return !code.empty(); } // LLStringUtil::format recogizes the following patterns. -- cgit v1.2.3 From b4b516b96689a2f8001bfebd641af7bb871ab11d Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 2 Nov 2009 08:35:37 -0800 Subject: Fix unclear function names around Pacific versus "SLT" time in string operations. Reviewed with Brad. --- indra/llcommon/llstring.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llcommon/llstring.cpp') diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 721e5670e7..c027aa7bdd 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -671,9 +671,9 @@ std::string ll_convert_wide_to_string(const wchar_t* in) } #endif // LL_WINDOWS -long LLStringOps::sltOffset; -long LLStringOps::localTimeOffset; -bool LLStringOps::daylightSavings; +long LLStringOps::sPacificTimeOffset = 0; +long LLStringOps::sLocalTimeOffset = 0; +bool LLStringOps::sPacificDaylightTime = 0; std::map LLStringOps::datetimeToCodes; S32 LLStringOps::collate(const llwchar* a, const llwchar* b) @@ -700,11 +700,11 @@ void LLStringOps::setupDatetimeInfo (bool daylight) tmpT = gmtime (&nowT); gmtT = mktime (tmpT); - localTimeOffset = (long) (gmtT - localT); + sLocalTimeOffset = (long) (gmtT - localT); - daylightSavings = daylight; - sltOffset = (daylightSavings? 7 : 8 ) * 60 * 60; + sPacificDaylightTime = daylight; + sPacificTimeOffset = (sPacificDaylightTime? 7 : 8 ) * 60 * 60; datetimeToCodes["wkday"] = "%a"; // Thu datetimeToCodes["weekday"] = "%A"; // Thursday @@ -957,7 +957,7 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token, } else if (param != "utc") // slt { - secFromEpoch -= LLStringOps::getSltOffset(); + secFromEpoch -= LLStringOps::getPacificTimeOffset(); } // if never fell into those two ifs above, param must be utc @@ -980,7 +980,7 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token, { // "slt" = Second Life Time, which is deprecated. // If not utc or user local time, fallback to Pacific time - replacement = LLStringOps::getDaylightSavings() ? "PDT" : "PST"; + replacement = LLStringOps::getPacificDaylightTime() ? "PDT" : "PST"; } return true; } -- cgit v1.2.3