Difference between revisions of "LlGetUnixTime/test"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{LSL conformance test
{{LSL conformance test
|intro=Scripts to test the conformance of the [[LSL llGetUnixTime]] function.
|intro=Scripts to test the conformance of the {{LSLG|llGetUnixTime}} function.
|scripts={{LSL conformance script
|scripts={{LSL conformance script
|title=llGetUnixTime test #1
|title=llGetUnixTime test #1
|intro=First test, copied from [http://secondlife.com/knowledgebase/article.php?id=199 the Second Life KB]
|intro=First test, copied from [http://secondlife.com/knowledgebase/article.php?id=199 the Second Life KB]
|status=draft
|status=draft
|lindensig=(none)
|lindensig=
|lindensigner=(none)
|lindensigner=
|text=  
|text=
default
<source lang="lsl2">
{
default
{
     touch_start(integer total_number)
     touch_start(integer total_number)
     {
     {
Line 20: Line 21:
         llOwnerSay("This object was touched at " + llGetDate() + "  " + time + ".  Unix time = " + (string)ut);
         llOwnerSay("This object was touched at " + llGetDate() + "  " + time + ".  Unix time = " + (string)ut);
     }
     }
}
}
</source>
|instructions=
|instructions=
# Put this script on an object in world
# Put this script on an object in world
Line 28: Line 30:
# Press 'Convert to a date'
# Press 'Convert to a date'
# Verify the date shown near the top of the web page matches the date and time said by the box
# Verify the date shown near the top of the web page matches the date and time said by the box
# Repeat 2 - 6 a few times
# Repeat steps 2 -> 6 a few times
|notes=
|notes=
|functionsused=[[LSL llGetUnixTime]]
|used_events=*{{LSLG|touch_start}}
|used_functions=*{{LSLG|llGetUnixTime}}
*{{LSLG|llGetGMTclock}}
*{{LSLG|llFloor}}
*{{LSLG|llGetDate}}
*{{LSLG|llOwnerSay}}
}}
}}
|notes=
|notes=
}}
}}

Latest revision as of 13:57, 25 January 2015



Purpose

Scripts to test the conformance of the llGetUnixTime function.

 

Scripts


llGetUnixTime test #1

Status: draft

Introduction

First test, copied from the Second Life KB

Script text

default
{
    touch_start(integer total_number)
    {
        string time;
        float ft = llGetGMTclock();
        integer ut = llGetUnixTime();
        integer hours = llFloor(ft / 3600);
        integer minutes = llFloor((ft - (hours*3600)) / 60.0);
        time = (string)hours+ ":" + (string)minutes + ":" + (string)(llFloor(ft) % 60);
        llOwnerSay("This object was touched at " + llGetDate() + "  " + time + ".  Unix time = " + (string)ut);
    }
}

Authorized Signature: (none) by (none)

Instructions

  1. Put this script on an object in world
  2. Touch the object
  3. Copy the number after 'Unix time ='
  4. Paste the number into the Timestamp box on http://www.4webhelp.net/us/timestamp.php
  5. Press 'Convert to a date'
  6. Verify the date shown near the top of the web page matches the date and time said by the box
  7. Repeat steps 2 -> 6 a few times

Events Used

Notes