summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2009-11-02 08:35:37 -0800
committerJames Cook <james@lindenlab.com>2009-11-02 08:35:37 -0800
commitb4b516b96689a2f8001bfebd641af7bb871ab11d (patch)
tree21ceddff27907da78df05acff9e21e38d0b0a075
parentc54faf28236dce5cf35233bf37ae64bd6837776f (diff)
Fix unclear function names around Pacific versus "SLT" time in string operations.
Reviewed with Brad.
-rw-r--r--indra/llcommon/llstring.cpp16
-rw-r--r--indra/llcommon/llstring.h17
-rw-r--r--indra/newview/llappviewer.cpp2
-rw-r--r--indra/newview/llappviewer.h4
-rw-r--r--indra/newview/lleventinfo.cpp1
-rw-r--r--indra/newview/llfloaterbump.cpp1
-rw-r--r--indra/newview/llstartup.cpp8
-rw-r--r--indra/newview/llworldmap.cpp1
8 files changed, 23 insertions, 27 deletions
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<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,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;
}
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 0f2f05a0d8..edbb007f61 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -151,9 +151,9 @@ struct char_traits<U16>
class LL_COMMON_API LLStringOps
{
private:
- static long sltOffset;
- static long localTimeOffset;
- static bool daylightSavings;
+ static long sPacificTimeOffset;
+ static long sLocalTimeOffset;
+ static bool sPacificDaylightTime;
static std::map<std::string, std::string> datetimeToCodes;
public:
@@ -184,10 +184,13 @@ public:
static S32 collate(const char* a, const char* b) { return strcoll(a, b); }
static S32 collate(const llwchar* a, const llwchar* b);
- static void setupDatetimeInfo (bool daylight);
- static long getSltOffset (void) {return sltOffset;}
- static long getLocalTimeOffset (void) {return localTimeOffset;}
- static bool getDaylightSavings (void) {return daylightSavings;}
+ static void setupDatetimeInfo(bool pacific_daylight_time);
+ static long getPacificTimeOffset(void) { return sPacificTimeOffset;}
+ static long getLocalTimeOffset(void) { return sLocalTimeOffset;}
+ // Is the Pacific time zone (aka server time zone)
+ // currently in daylight savings time?
+ static bool getPacificDaylightTime(void) { return sPacificDaylightTime;}
+
static std::string getDatetimeCode (std::string key);
};
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 06c9171d67..873215169e 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -238,8 +238,6 @@ U32 gFrameCount = 0;
U32 gForegroundFrameCount = 0; // number of frames that app window was in foreground
LLPumpIO* gServicePump = NULL;
-BOOL gPacificDaylightTime = FALSE;
-
U64 gFrameTime = 0;
F32 gFrameTimeSeconds = 0.f;
F32 gFrameIntervalSeconds = 0.f;
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index d970aa6ae1..73256a8fe6 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -301,10 +301,6 @@ extern U32 gForegroundFrameCount;
extern LLPumpIO* gServicePump;
-// Is the Pacific time zone (aka server time zone)
-// currently in daylight savings time?
-extern BOOL gPacificDaylightTime;
-
extern U64 gFrameTime; // The timestamp of the most-recently-processed frame
extern F32 gFrameTimeSeconds; // Loses msec precision after ~4.5 hours...
extern F32 gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds
diff --git a/indra/newview/lleventinfo.cpp b/indra/newview/lleventinfo.cpp
index 9be45d18fb..aabd7ed997 100644
--- a/indra/newview/lleventinfo.cpp
+++ b/indra/newview/lleventinfo.cpp
@@ -33,7 +33,6 @@
#include "llviewerprecompiledheaders.h"
#include "lleventinfo.h"
-#include "llappviewer.h" // for gPacificDaylightTime
#include "lluuid.h"
#include "message.h"
diff --git a/indra/newview/llfloaterbump.cpp b/indra/newview/llfloaterbump.cpp
index 8b64f913e0..68f06b1e5b 100644
--- a/indra/newview/llfloaterbump.cpp
+++ b/indra/newview/llfloaterbump.cpp
@@ -40,7 +40,6 @@
#include "llsd.h"
#include "lluictrlfactory.h"
#include "llviewermessage.h"
-#include "llappviewer.h" // gPacificDaylightTime
///----------------------------------------------------------------------------
/// Class LLFloaterBump
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 43b039f94e..9aa74e8b9f 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1149,7 +1149,8 @@ bool idle_startup()
}
//setup map of datetime strings to codes and slt & local time offset from utc
- LLStringOps::setupDatetimeInfo (gPacificDaylightTime);
+ // *TODO: Does this need to be here?
+ LLStringOps::setupDatetimeInfo (false);
transition_back_to_login_panel(emsg.str());
show_connect_box = true;
}
@@ -3037,14 +3038,15 @@ bool process_login_success_response()
gAgent.setGenderChosen(TRUE);
}
+ bool pacific_daylight_time = false;
flag = login_flags["daylight_savings"].asString();
if(flag == "Y")
{
- gPacificDaylightTime = (flag == "Y") ? TRUE : FALSE;
+ pacific_daylight_time = (flag == "Y");
}
//setup map of datetime strings to codes and slt & local time offset from utc
- LLStringOps::setupDatetimeInfo (gPacificDaylightTime);
+ LLStringOps::setupDatetimeInfo(pacific_daylight_time);
}
LLSD initial_outfit = response["initial-outfit"][0];
diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp
index 829d631473..f198f3a0cf 100644
--- a/indra/newview/llworldmap.cpp
+++ b/indra/newview/llworldmap.cpp
@@ -37,7 +37,6 @@
#include "llregionhandle.h"
#include "message.h"
-#include "llappviewer.h" // for gPacificDaylightTime
#include "llagent.h"
#include "llmapresponders.h"
#include "llviewercontrol.h"