diff options
author | Justin Clark-Casey (justincc) | 2010-11-17 01:45:47 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-11-17 01:45:47 +0000 |
commit | 393c9c9046595b104a4c3a3671974af33cf902ce (patch) | |
tree | 1f407cd17905a436724d503c314885807aaa98b3 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-393c9c9046595b104a4c3a3671974af33cf902ce.zip opensim-SC_OLD-393c9c9046595b104a4c3a3671974af33cf902ce.tar.gz opensim-SC_OLD-393c9c9046595b104a4c3a3671974af33cf902ce.tar.bz2 opensim-SC_OLD-393c9c9046595b104a4c3a3671974af33cf902ce.tar.xz |
Add osUnixTimeToTimestamp()
This allows an input unix time to be converted to an llGetTimeStamp() format.
Thanks Thomax.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 18 |
1 files changed, 17 insertions, 1 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 |