From 393c9c9046595b104a4c3a3671974af33cf902ce Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 17 Nov 2010 01:45:47 +0000 Subject: Add osUnixTimeToTimestamp() This allows an input unix time to be converted to an llGetTimeStamp() format. Thanks Thomax. --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 18 +++++++++++++++++- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 13 ++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e6a323e..fc92f23 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2298,5 +2298,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api }); return result; } + + /// + /// Convert a unix time to a llGetTimestamp() like string + /// + /// + /// + public LSL_String osUnixTimeToTimestamp(long time) + { + CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp"); + long baseTicks = 621355968000000000; + long tickResolution = 10000000; + long epochTicks = (time * tickResolution) + baseTicks; + DateTime date = new DateTime(epochTicks); + + return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); + } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index c9a24f6..10d61ca 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -184,5 +184,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List osGetAvatarList(); + LSL_String osUnixTimeToTimestamp(long time); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 370bf1d..f3142e6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -678,26 +678,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osGetSimulatorMemory(); } + public void osKickAvatar(string FirstName,string SurName,string alert) { m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); } + public void osSetSpeed(string UUID, float SpeedModifier) { m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); } + public void osCauseDamage(string avatar, double damage) { m_OSSL_Functions.osCauseDamage(avatar, damage); } + public void osCauseHealing(string avatar, double healing) { m_OSSL_Functions.osCauseHealing(avatar, healing); } + public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) { return m_OSSL_Functions.osGetPrimitiveParams(prim, rules); } + public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) { m_OSSL_Functions.osSetPrimitiveParams(prim, rules); @@ -717,5 +723,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osGetAvatarList(); } + + public LSL_String osUnixTimeToTimestamp(long time) + { + return m_OSSL_Functions.osUnixTimeToTimestamp(time); + } } -} +} \ No newline at end of file -- cgit v1.1