OsUnixTimeToTimestamp

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Cosmetic)
 
(6 intermediate revisions by one user not shown)
Line 5: Line 5:
 
|additional_info=This function was added in 0.7.2-post-fixes
 
|additional_info=This function was added in 0.7.2-post-fixes
 
|function_syntax=string osUnixTimeToTimestamp(integer epoch);
 
|function_syntax=string osUnixTimeToTimestamp(integer epoch);
 +
|description=This function allows an input Unix time to be converted to an llGetTimeStamp() format.
 +
 +
Please note that there will be no second fractions.
 +
 +
This is because the implementation works with seconds only.
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
 
//
 
//
 
// osUnixTimeToTimestamp Script Example
 
// osUnixTimeToTimestamp Script Example
 +
// Author: djphil
 
//
 
//
 
+
// Prints something similar to this:
+
// [01:00] Object: 2020-11-24T22:32:29.3743203Z
+
// [01:00] Object: 2020-11-24T22:32:29.0000000Z
+
 
+
 
default
 
default
 
{
 
{
 
     state_entry()
 
     state_entry()
 
     {
 
     {
         llOwnerSay(llGetTimestamp());
+
         llSay(PUBLIC_CHANNEL, "Touch to see osUnixTimeToTimestamp usage.");
        llOwnerSay(osUnixTimeToTimestamp((integer)llGetUnixTime()));
+
    }
 +
 +
    touch_start(integer number)
 +
    {
 +
        integer epoch = llGetUnixTime();
 +
        llSay(PUBLIC_CHANNEL, "Clicked at " + osUnixTimeToTimestamp(epoch));
 
     }
 
     }
 
}
 
}
 
</source>
 
</source>
|description=This function allows an input Unix time to be converted to an llGetTimeStamp() format. Please note that there will be no second fractions. This is because the implementation works with seconds only.
+
|additional_info=
|
+
 
}}
 
}}
 +
== See Also ==
 +
* [[osGetPSTWallclock]]
 +
* [[osUnixTimeToTimestamp]]

Latest revision as of 01:15, 2 January 2021

string osUnixTimeToTimestamp(integer epoch);
This function allows an input Unix time to be converted to an llGetTimeStamp() format.

Please note that there will be no second fractions.

This is because the implementation works with seconds only.

Threat Level VeryLow
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
//
// osUnixTimeToTimestamp Script Example
// Author: djphil
//
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osUnixTimeToTimestamp usage.");
    }
 
    touch_start(integer number)
    {
        integer epoch = llGetUnixTime();
        llSay(PUBLIC_CHANNEL, "Clicked at " + osUnixTimeToTimestamp(epoch));
    }
}


[edit] See Also

Personal tools
General
About This Wiki