Fix unclear function names around Pacific versus "SLT" time in string operations.

Reviewed with Brad.
master
James Cook 2009-11-02 08:35:37 -08:00
parent c54faf2823
commit b4b516b966
8 changed files with 23 additions and 27 deletions

View File

@ -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;
}

View File

@ -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);
};

View File

@ -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;

View File

@ -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

View File

@ -33,7 +33,6 @@
#include "llviewerprecompiledheaders.h"
#include "lleventinfo.h"
#include "llappviewer.h" // for gPacificDaylightTime
#include "lluuid.h"
#include "message.h"

View File

@ -40,7 +40,6 @@
#include "llsd.h"
#include "lluictrlfactory.h"
#include "llviewermessage.h"
#include "llappviewer.h" // gPacificDaylightTime
///----------------------------------------------------------------------------
/// Class LLFloaterBump

View File

@ -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];

View File

@ -37,7 +37,6 @@
#include "llregionhandle.h"
#include "message.h"
#include "llappviewer.h" // for gPacificDaylightTime
#include "llagent.h"
#include "llmapresponders.h"
#include "llviewercontrol.h"