mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
Calculate the Daylight Savings Time information sent to the viewer based on US Pacific Standard Time rather than whatever timezone the login server is set to.
This is because the viewer doesn't receive a timezone from the server but bases its displays on Pacific Standard Time. However, it still expects to receive notification from the server as to whether or not Daylight Savings Time for PST is in operation. This commit introduces a new DSTZone setting in the [LoginService] config setting that accepts a list of timezone names valid across different platforms to calculate Pacific DST. If you need the old behaviour of calculating DST based on the local timezone of the server running the login service, then please override DSTZone with "local". A mailing list announcement will be made later. Thanks to Olivier Van Helden and Gudule Lapointe for determining this behaviour and providing this patch. From http://opensimulator.org/mantis/view.php?id=5972
This commit is contained in:
@@ -226,7 +226,8 @@ namespace OpenSim.Services.LLLoginService
|
||||
public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo,
|
||||
GridRegion destination, List<InventoryFolderBase> invSkel, FriendInfo[] friendsList, ILibraryService libService,
|
||||
string where, string startlocation, Vector3 position, Vector3 lookAt, List<InventoryItemBase> gestures, string message,
|
||||
GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency)
|
||||
GridRegion home, IPEndPoint clientIP, string mapTileURL, string profileURL, string openIDURL, string searchURL, string currency,
|
||||
string DSTZone)
|
||||
: this()
|
||||
{
|
||||
FillOutInventoryData(invSkel, libService);
|
||||
@@ -255,7 +256,45 @@ namespace OpenSim.Services.LLLoginService
|
||||
FillOutRegionData(destination);
|
||||
|
||||
FillOutSeedCap(aCircuit, destination, clientIP);
|
||||
|
||||
|
||||
switch (DSTZone)
|
||||
{
|
||||
case "none":
|
||||
DST = "N";
|
||||
break;
|
||||
case "local":
|
||||
DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
|
||||
break;
|
||||
default:
|
||||
TimeZoneInfo dstTimeZone = null;
|
||||
string[] tzList = DSTZone.Split(';');
|
||||
|
||||
foreach (string tzName in tzList)
|
||||
{
|
||||
try
|
||||
{
|
||||
dstTimeZone = TimeZoneInfo.FindSystemTimeZoneById(tzName);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (dstTimeZone == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[LLOGIN RESPONSE]: No valid timezone found for DST in {0}, falling back to system time.", tzList);
|
||||
DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
|
||||
}
|
||||
else
|
||||
{
|
||||
DST = dstTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N";
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void FillOutInventoryData(List<InventoryFolderBase> invSkel, ILibraryService libService)
|
||||
|
||||
@@ -82,6 +82,8 @@ namespace OpenSim.Services.LLLoginService
|
||||
protected string m_AllowedClients;
|
||||
protected string m_DeniedClients;
|
||||
|
||||
protected string m_DSTZone;
|
||||
|
||||
IConfig m_LoginServerConfig;
|
||||
// IConfig m_ClientsConfig;
|
||||
|
||||
@@ -118,6 +120,8 @@ namespace OpenSim.Services.LLLoginService
|
||||
m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
|
||||
m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty);
|
||||
|
||||
m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time");
|
||||
|
||||
// Clean up some of these vars
|
||||
if (m_MapTileURL != String.Empty)
|
||||
{
|
||||
@@ -240,6 +244,7 @@ namespace OpenSim.Services.LLLoginService
|
||||
|
||||
m_log.InfoFormat("[LLOGIN SERVICE]: Login request for {0} {1} at {2} using viewer {3}, channel {4}, IP {5}, Mac {6}, Id0 {7}",
|
||||
firstName, lastName, startLocation, clientVersion, channel, clientIP.Address.ToString(), mac, id0);
|
||||
|
||||
try
|
||||
{
|
||||
//
|
||||
@@ -416,8 +421,11 @@ namespace OpenSim.Services.LLLoginService
|
||||
//
|
||||
// Finally, fill out the response and return it
|
||||
//
|
||||
LLLoginResponse response = new LLLoginResponse(account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
|
||||
where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency);
|
||||
LLLoginResponse response
|
||||
= new LLLoginResponse(
|
||||
account, aCircuit, guinfo, destination, inventorySkel, friendsList, m_LibraryService,
|
||||
where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP,
|
||||
m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone);
|
||||
|
||||
m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client.");
|
||||
return response;
|
||||
@@ -431,7 +439,10 @@ namespace OpenSim.Services.LLLoginService
|
||||
}
|
||||
}
|
||||
|
||||
protected GridRegion FindDestination(UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation, GridRegion home, out GridRegion gatekeeper, out string where, out Vector3 position, out Vector3 lookAt, out TeleportFlags flags)
|
||||
protected GridRegion FindDestination(
|
||||
UserAccount account, UUID scopeID, GridUserInfo pinfo, UUID sessionID, string startLocation,
|
||||
GridRegion home, out GridRegion gatekeeper,
|
||||
out string where, out Vector3 position, out Vector3 lookAt, out TeleportFlags flags)
|
||||
{
|
||||
flags = TeleportFlags.ViaLogin;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user