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

This commit is contained in:
UbitUmarov
2019-04-08 13:50:51 +01:00
parent 539a3a9273
commit b104934a25
4 changed files with 93 additions and 60 deletions

View File

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

View File

@@ -549,5 +549,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_String osGetInventoryName(LSL_Key itemId);
LSL_String osGetInventoryDesc(LSL_String itemNameOrId);
LSL_Key osGetLastChangedEventKey();
LSL_Float osGetPSTWallclock();
}
}

View File

@@ -1381,5 +1381,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
{
return m_OSSL_Functions.osGetLastChangedEventKey();
}
public LSL_Float osGetPSTWallclock()
{
return m_OSSL_Functions.osGetPSTWallclock();
}
}
}