summaryrefslogtreecommitdiff
path: root/indra/llcommon/llstring.cpp
diff options
context:
space:
mode:
authorRick Pasetto <rick@lindenlab.com>2009-11-02 09:54:52 -0800
committerRick Pasetto <rick@lindenlab.com>2009-11-02 09:54:52 -0800
commit9ed8b5299f2e5a8a912649e0e6aecaf89b034408 (patch)
treee7c9ecc91fbbef0c26fd352f2743ac050d8f889e /indra/llcommon/llstring.cpp
parent55731ee318e6e3c2e9998c6347cbd9d3635115c4 (diff)
parent3783852444825edf420e6109927df21fd004c3e7 (diff)
Merge from remote repo
Diffstat (limited to 'indra/llcommon/llstring.cpp')
-rw-r--r--indra/llcommon/llstring.cpp45
1 files changed, 22 insertions, 23 deletions
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index f2edd5c559..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<std::string, std::string> 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,36 +957,35 @@ 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
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?
- replacement = LLStringOps::getDaylightSavings() ? "PDT" : "PST";
-
- return true;
- }
- replacement = datetime->toHTTPDateString(code);
-
- if (code.empty())
- {
- return false;
- }
- else
- {
+ }
+ 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::getPacificDaylightTime() ? "PDT" : "PST";
+ }
return true;
}
+ replacement = datetime.toHTTPDateString(code);
+ return !code.empty();
}
// LLStringUtil::format recogizes the following patterns.