Stamp2UnixInt

From Second Life Wiki
Jump to navigation Jump to search

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

<source lang="lsl2">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: <source lang="lsl2">llParseString2List( llGetTimestamp(), ["-", "T", ":", "."], [] )</source>and<source lang="lsl2">llParseString2List( llGetDate(), ["-"], [] )</source>