Difference between revisions of "Stamp2UnixInt"
Jump to navigation
Jump to search
Void Singer (talk | contribs) (moved from user page) |
Void Singer (talk | contribs) m (fixed byte costs) |
||
Line 2: | Line 2: | ||
<div style="float:right;">__TOC__</div> | <div style="float:right;">__TOC__</div> | ||
{{void-box | {{void-box | ||
|title=<div style="display:none"><h2>Summary</h2></div>[[:Category:LSL_User-Defined_Functions|User-Defined Function]]: [[integer]] uStamp2UnixInt( [[list]] ''vLstStp' ); | |title=<div style="display:none"><h2>Summary</h2></div>[[:Category:LSL_User-Defined_Functions|User-Defined Function]]: [[integer]] uStamp2UnixInt( [[list]] ''vLstStp'' ); | ||
|content= | |content= | ||
Returns an integer that is the Unix time code represented by the input list | Returns an integer that is the Unix time code represented by the input list | ||
Line 38: | Line 38: | ||
<h3>Minimal Version</h3> | <h3>Minimal Version</h3> | ||
(Safely supports missing Day/Month) | (Safely supports missing Day/Month) | ||
* LSO: | * LSO: 505 bytes | ||
* MONO: 1024 bytes | * MONO: 1024 bytes | ||
<!-- Please replace with similarly licensed code only --> | <!-- Please replace with similarly licensed code only --> | ||
Line 68: | Line 68: | ||
<h3>Safe(er) Version</h3> | <h3>Safe(er) Version</h3> | ||
(Supports missing Day/Month and bad inputs are capped) | (Supports missing Day/Month and bad inputs are capped) | ||
* LSO: | * LSO: 640 bytes | ||
* MONO: | * MONO: 1536 bytes | ||
<!-- Please replace with similarly licensed code only --> | <!-- Please replace with similarly licensed code only --> | ||
<lsl>integer uStamp2UnixInt( list vLstStp ){ | <lsl>integer uStamp2UnixInt( list vLstStp ){ |
Revision as of 14:16, 12 October 2010
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials | User-Defined Functions | Void's User Page |
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>