From 0e3053e4c97670e897496ffa98d7039bf686e6d2 Mon Sep 17 00:00:00 2001 From: Olivier van Helden and Gudule Lapointe (Speculoos.net) Date: Thu, 19 Apr 2012 01:17:56 +0200 Subject: DST settings to match client default Pacific Time (mantis #5972) --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/LLLoginService/LLLoginResponse.cs') diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 844c5ae..8fdcf4e 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -349,7 +349,21 @@ namespace OpenSim.Services.LLLoginService private void SetDefaultValues() { - DST = TimeZone.CurrentTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; + TimeZoneInfo gridTimeZone; + try + { + // First try to fetch DST from Pacific Standard Time, because this is + // the one expected by the viewer. "US/Pacific" is the string to search + // on linux and mac, and should work also on Windows (to confirm) + gridTimeZone = TimeZoneInfo.FindSystemTimeZoneById("US/Pacific"); + } + catch (Exception e) + { + m_log.WarnFormat("[TIMEZONE]: {0} Falling back to system time. System time should be set to Pacific Standard Time to provide the expected time", e.Message); + gridTimeZone = TimeZoneInfo.Local; + } + DST = gridTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; + StipendSinceLogin = "N"; Gendered = "Y"; EverLoggedIn = "Y"; -- cgit v1.1 From cbe889e10bc06f0a3e31b4094c88bf022635dff9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 24 Apr 2012 20:30:19 +0100 Subject: minor: formatting changes to top of LLLoginResponse.SetDefaultValues(), chiefly some break up of the long line. --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services/LLLoginService/LLLoginResponse.cs') diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 8fdcf4e..10a44ed 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -350,6 +350,7 @@ namespace OpenSim.Services.LLLoginService private void SetDefaultValues() { TimeZoneInfo gridTimeZone; + try { // First try to fetch DST from Pacific Standard Time, because this is @@ -359,9 +360,13 @@ namespace OpenSim.Services.LLLoginService } catch (Exception e) { - m_log.WarnFormat("[TIMEZONE]: {0} Falling back to system time. System time should be set to Pacific Standard Time to provide the expected time", e.Message); + m_log.WarnFormat( + "[TIMEZONE]: {0} Falling back to system time. System time should be set to Pacific Standard Time to provide the expected time", + e.Message); + gridTimeZone = TimeZoneInfo.Local; } + DST = gridTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; StipendSinceLogin = "N"; -- cgit v1.1 From 54d5ff67747ada5c0252a5063c29d6dc0deb074e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 24 Apr 2012 23:00:50 +0100 Subject: Go back to always using the local timezone for now - not all machines have US/Pacific or Olsen Amercia/Los_Angeles and this introduces variability that the server operator cannot control Please see http://opensimulator.org/mantis/view.php?id=5972 soon for more comments. --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 31 +++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'OpenSim/Services/LLLoginService/LLLoginResponse.cs') diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 10a44ed..01de159 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -351,21 +351,26 @@ namespace OpenSim.Services.LLLoginService { TimeZoneInfo gridTimeZone; - try - { - // First try to fetch DST from Pacific Standard Time, because this is - // the one expected by the viewer. "US/Pacific" is the string to search - // on linux and mac, and should work also on Windows (to confirm) - gridTimeZone = TimeZoneInfo.FindSystemTimeZoneById("US/Pacific"); - } - catch (Exception e) - { - m_log.WarnFormat( - "[TIMEZONE]: {0} Falling back to system time. System time should be set to Pacific Standard Time to provide the expected time", - e.Message); + // Disabled for now pending making timezone a config value, which can at some point have a default of + // a ; separated list of possible timezones. + // The problem here is that US/Pacific (or even the Olsen America/Los_Angeles) is not universal across + // windows, mac and various distributions of linux, introducing another element of consistency. + // The server operator needs to be able to control this setting +// try +// { +// // First try to fetch DST from Pacific Standard Time, because this is +// // the one expected by the viewer. "US/Pacific" is the string to search +// // on linux and mac, and should work also on Windows (to confirm) +// gridTimeZone = TimeZoneInfo.FindSystemTimeZoneById("US/Pacific"); +// } +// catch (Exception e) +// { +// m_log.WarnFormat( +// "[TIMEZONE]: {0} Falling back to system time. System time should be set to Pacific Standard Time to provide the expected time", +// e.Message); gridTimeZone = TimeZoneInfo.Local; - } +// } DST = gridTimeZone.IsDaylightSavingTime(DateTime.Now) ? "Y" : "N"; -- cgit v1.1 From cccef2e56dc8b02ccd83fb1c832e4ce026cdcaf9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 May 2012 19:21:43 +0100 Subject: 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 --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 43 +++++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/LLLoginService/LLLoginResponse.cs') diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 01de159..6b3bc84 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -226,7 +226,8 @@ namespace OpenSim.Services.LLLoginService public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, GridUserInfo pinfo, GridRegion destination, List invSkel, FriendInfo[] friendsList, ILibraryService libService, string where, string startlocation, Vector3 position, Vector3 lookAt, List 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 invSkel, ILibraryService libService) -- cgit v1.1 From c84ef57e5273ac2c8703c75406138c58f9c19d0f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 4 May 2012 21:04:42 +0100 Subject: minor: remove mono compiler warning --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/LLLoginService/LLLoginResponse.cs') diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 6b3bc84..9ec744f 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -275,7 +275,7 @@ namespace OpenSim.Services.LLLoginService { dstTimeZone = TimeZoneInfo.FindSystemTimeZoneById(tzName); } - catch (Exception e) + catch { continue; } -- cgit v1.1