diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-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 |