aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-11-17 01:45:47 +0000
committerJustin Clark-Casey (justincc)2010-11-17 01:45:47 +0000
commit393c9c9046595b104a4c3a3671974af33cf902ce (patch)
tree1f407cd17905a436724d503c314885807aaa98b3 /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-393c9c9046595b104a4c3a3671974af33cf902ce.zip
opensim-SC-393c9c9046595b104a4c3a3671974af33cf902ce.tar.gz
opensim-SC-393c9c9046595b104a4c3a3671974af33cf902ce.tar.bz2
opensim-SC-393c9c9046595b104a4c3a3671974af33cf902ce.tar.xz
Add osUnixTimeToTimestamp()
This allows an input unix time to be converted to an llGetTimeStamp() format. Thanks Thomax.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs18
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs13
3 files changed, 30 insertions, 2 deletions
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
2298 }); 2298 });
2299 return result; 2299 return result;
2300 } 2300 }
2301
2302 /// <summary>
2303 /// Convert a unix time to a llGetTimestamp() like string
2304 /// </summary>
2305 /// <param name="unixTime"></param>
2306 /// <returns></returns>
2307 public LSL_String osUnixTimeToTimestamp(long time)
2308 {
2309 CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp");
2310 long baseTicks = 621355968000000000;
2311 long tickResolution = 10000000;
2312 long epochTicks = (time * tickResolution) + baseTicks;
2313 DateTime date = new DateTime(epochTicks);
2314
2315 return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");
2316 }
2301 } 2317 }
2302} 2318} \ 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
184 184
185 LSL_List osGetAvatarList(); 185 LSL_List osGetAvatarList();
186 186
187 LSL_String osUnixTimeToTimestamp(long time);
187 } 188 }
188} 189}
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
678 { 678 {
679 return m_OSSL_Functions.osGetSimulatorMemory(); 679 return m_OSSL_Functions.osGetSimulatorMemory();
680 } 680 }
681
681 public void osKickAvatar(string FirstName,string SurName,string alert) 682 public void osKickAvatar(string FirstName,string SurName,string alert)
682 { 683 {
683 m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert); 684 m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert);
684 } 685 }
686
685 public void osSetSpeed(string UUID, float SpeedModifier) 687 public void osSetSpeed(string UUID, float SpeedModifier)
686 { 688 {
687 m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier); 689 m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier);
688 } 690 }
691
689 public void osCauseDamage(string avatar, double damage) 692 public void osCauseDamage(string avatar, double damage)
690 { 693 {
691 m_OSSL_Functions.osCauseDamage(avatar, damage); 694 m_OSSL_Functions.osCauseDamage(avatar, damage);
692 } 695 }
696
693 public void osCauseHealing(string avatar, double healing) 697 public void osCauseHealing(string avatar, double healing)
694 { 698 {
695 m_OSSL_Functions.osCauseHealing(avatar, healing); 699 m_OSSL_Functions.osCauseHealing(avatar, healing);
696 } 700 }
701
697 public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules) 702 public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
698 { 703 {
699 return m_OSSL_Functions.osGetPrimitiveParams(prim, rules); 704 return m_OSSL_Functions.osGetPrimitiveParams(prim, rules);
700 } 705 }
706
701 public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) 707 public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules)
702 { 708 {
703 m_OSSL_Functions.osSetPrimitiveParams(prim, rules); 709 m_OSSL_Functions.osSetPrimitiveParams(prim, rules);
@@ -717,5 +723,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
717 { 723 {
718 return m_OSSL_Functions.osGetAvatarList(); 724 return m_OSSL_Functions.osGetAvatarList();
719 } 725 }
726
727 public LSL_String osUnixTimeToTimestamp(long time)
728 {
729 return m_OSSL_Functions.osUnixTimeToTimestamp(time);
730 }
720 } 731 }
721} 732} \ No newline at end of file