From b104934a258c34a77c0470b8495d9d286c82f4f5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 8 Apr 2019 13:50:51 +0100 Subject: add osGetPSTWallclock() returns wall clock in PST or PDT, for those that for some odd reason think need it. OpenSim girds shoudl use UTC (gtm) but whatever --- .../Shared/Api/Implementation/OSSL_Api.cs | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7348499..4a74c15 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -145,6 +145,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected IUrlModule m_UrlModule = null; protected ISoundModule m_SoundModule = null; internal IConfig m_osslconfig; + internal TimeZoneInfo PSTTimeZone = null; public void Initialize( IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item) @@ -201,7 +202,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api default: break; } - } + + try + { + PSTTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"); + } + catch + { + PSTTimeZone = null; + } + } public override Object InitializeLifetimeService() { @@ -5441,5 +5451,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return String.Empty; return detectedParams.Key.ToString(); } + + // returns PST or PDT wall clock + public LSL_Float osGetPSTWallclock() + { + m_host.AddScriptLPS(1); + if(PSTTimeZone == null) + return DateTime.Now.TimeOfDay.TotalSeconds; + + DateTime time = TimeZoneInfo.ConvertTime(DateTime.UtcNow, PSTTimeZone); + return time.TimeOfDay.TotalSeconds; + } } } \ No newline at end of file -- cgit v1.1