Difference between revisions of "Stamp2UnixInt"

From Second Life Wiki
Jump to navigation Jump to search
(moved from user page)
(No difference)

Revision as of 15:08, 12 October 2010

Summary

User-Defined Function: integer uStamp2UnixInt( list vLstStp' );

Returns an integer that is the Unix time code represented by the input list

  • vLstStmp: source time stamp list of format [Y, M, D, h, m, s]


Unsafe Version

(Missing day/month or bad values not handled)

  • LSO: 465 bytes
  • MONO: 1024 bytes

<lsl>integer uStamp2UnixInt( list vLstStp ){

   integer vIntYear = llList2Integer( vLstStp, 0 ) - 1902;
   integer vIntRtn;
if (vIntYear >> 31

Caveats

  • Time codes before the year 1902 or past the end of 2037 are capped to the first second of 1902 and 2038 respectively

Notes

  • Input list elements past the first six are ignored
  • Input format is compattible with: <lsl>llParseString2List( llGetTimestamp(), ["-", "T", ":", "."], [] )</lsl>and<lsl>llParseString2List( llGetDate(), ["-"], [] )</lsl>