Add osUnixTimeToTimestamp()

This allows an input unix time to be converted to an llGetTimeStamp() format.
Thanks Thomax.
This commit is contained in:
Justin Clark-Casey (justincc)
2010-11-17 01:45:47 +00:00
parent b38a1594c1
commit 393c9c9046
3 changed files with 30 additions and 2 deletions

View File

@@ -2298,5 +2298,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
});
return result;
}
/// <summary>
/// Convert a unix time to a llGetTimestamp() like string
/// </summary>
/// <param name="unixTime"></param>
/// <returns></returns>
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");
}
}
}
}