Millisec

From Second Life Wiki
Revision as of 04:43, 29 January 2025 by Gwyneth Llewelyn (talk | contribs) (Replaced deprecated <source> tag with <syntaxhighlight>)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

User-Defined Function: integer Millisec( string Stamp );

Returns an integer of milliseconds that is within a months range, starting from -617316353 to 2147483547.

  • Stamp: a string formatted as it comes from llGetTimestamp

<syntaxhighlight lang="lsl2"> integer Millisec(string Stamp) {

   return (integer)llGetSubString(Stamp, 8, 9) * 86400000 + // Days
       (integer)llGetSubString(Stamp, 11, 12) * 3600000 + // Hours
       (integer)llGetSubString(Stamp, 14, 15) * 60000 + // Minutes
       llRound(((float)llGetSubString(Stamp, 17, -2) * 1000.0)) // Seconds.Milliseconds
       - 617316353; // Offset to fit between [-617316353,2147483547]

} /*// Released to Public Domain without limitation. Created by Nexii Malthus. //*/

</syntaxhighlight>

Caveats

  • Accurate to within a month