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 7ce3716..26ef0dd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2311,5 +2311,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2311 | }); | 2311 | }); |
2312 | return result; | 2312 | return result; |
2313 | } | 2313 | } |
2314 | |||
2315 | /// <summary> | ||
2316 | /// Convert a unix time to a llGetTimestamp() like string | ||
2317 | /// </summary> | ||
2318 | /// <param name="unixTime"></param> | ||
2319 | /// <returns></returns> | ||
2320 | public LSL_String osUnixTimeToTimestamp(long time) | ||
2321 | { | ||
2322 | CheckThreatLevel(ThreatLevel.VeryLow, "osUnixTimeToTimestamp"); | ||
2323 | long baseTicks = 621355968000000000; | ||
2324 | long tickResolution = 10000000; | ||
2325 | long epochTicks = (time * tickResolution) + baseTicks; | ||
2326 | DateTime date = new DateTime(epochTicks); | ||
2327 | |||
2328 | return date.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); | ||
2329 | } | ||
2314 | } | 2330 | } |
2315 | } | 2331 | } \ No newline at end of file |