Add osUnixTimeToTimestamp()
This allows an input unix time to be converted to an llGetTimeStamp() format. Thanks Thomax.viewer-2-initial-appearance
parent
b38a1594c1
commit
393c9c9046
|
@ -2298,5 +2298,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
});
|
});
|
||||||
return result;
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -184,5 +184,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
|
|
||||||
LSL_List osGetAvatarList();
|
LSL_List osGetAvatarList();
|
||||||
|
|
||||||
|
LSL_String osUnixTimeToTimestamp(long time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -678,26 +678,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
{
|
{
|
||||||
return m_OSSL_Functions.osGetSimulatorMemory();
|
return m_OSSL_Functions.osGetSimulatorMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void osKickAvatar(string FirstName,string SurName,string alert)
|
public void osKickAvatar(string FirstName,string SurName,string alert)
|
||||||
{
|
{
|
||||||
m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert);
|
m_OSSL_Functions.osKickAvatar(FirstName, SurName, alert);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void osSetSpeed(string UUID, float SpeedModifier)
|
public void osSetSpeed(string UUID, float SpeedModifier)
|
||||||
{
|
{
|
||||||
m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier);
|
m_OSSL_Functions.osSetSpeed(UUID, SpeedModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void osCauseDamage(string avatar, double damage)
|
public void osCauseDamage(string avatar, double damage)
|
||||||
{
|
{
|
||||||
m_OSSL_Functions.osCauseDamage(avatar, damage);
|
m_OSSL_Functions.osCauseDamage(avatar, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void osCauseHealing(string avatar, double healing)
|
public void osCauseHealing(string avatar, double healing)
|
||||||
{
|
{
|
||||||
m_OSSL_Functions.osCauseHealing(avatar, healing);
|
m_OSSL_Functions.osCauseHealing(avatar, healing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
|
public LSL_List osGetPrimitiveParams(LSL_Key prim, LSL_List rules)
|
||||||
{
|
{
|
||||||
return m_OSSL_Functions.osGetPrimitiveParams(prim, rules);
|
return m_OSSL_Functions.osGetPrimitiveParams(prim, rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules)
|
public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules)
|
||||||
{
|
{
|
||||||
m_OSSL_Functions.osSetPrimitiveParams(prim, rules);
|
m_OSSL_Functions.osSetPrimitiveParams(prim, rules);
|
||||||
|
@ -717,5 +723,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
{
|
{
|
||||||
return m_OSSL_Functions.osGetAvatarList();
|
return m_OSSL_Functions.osGetAvatarList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LSL_String osUnixTimeToTimestamp(long time)
|
||||||
|
{
|
||||||
|
return m_OSSL_Functions.osUnixTimeToTimestamp(time);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue