mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1381,5 +1381,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
{
|
||||
return m_OSSL_Functions.osGetLastChangedEventKey();
|
||||
}
|
||||
|
||||
public LSL_Float osGetPSTWallclock()
|
||||
{
|
||||
return m_OSSL_Functions.osGetPSTWallclock();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user