Difference between revisions of "User:Trinity Coulter/Using HTTPRequest to Convert GMT to Unix time"
Jump to navigation
Jump to search
(New page: Neat little script to help with an overly complicated task in regular LSL. <lsl> string myGMTTime; default { state_entry() { llSay(0,"Touch to convert GMT to Unix time"); ...) |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 21: | Line 21: | ||
{ | { | ||
body = llGetSubString(body, 50, -9); | body = llGetSubString(body, 50, -9); | ||
llSay(0,myGMTTime + " converts to " + | //corrects HTTP response from server's Eastern to UTC | ||
integer timecorrect = (integer)body - 18000; | |||
llSay(0,myGMTTime + " converts to " + (string)timecorrect); | |||
} | } | ||
} | } | ||
</lsl> | </lsl> |
Latest revision as of 06:12, 4 September 2008
Neat little script to help with an overly complicated task in regular LSL.
<lsl> string myGMTTime; default {
state_entry() { llSay(0,"Touch to convert GMT to Unix time"); } touch_start(integer total_number) { myGMTTime = llGetTimestamp(); string toUnix = "http://www.iwebtool.com/tool/tools/unix_time_converter/unix_time_converter.php?year=" + llGetSubString(myGMTTime,0,3) + "&mon=" + llGetSubString(myGMTTime,5,6) + "&day=" + llGetSubString(myGMTTime,8,9) + "&hour=" + llGetSubString(myGMTTime,11,12) + "&min=" + llGetSubString(myGMTTime,14,15) + "&sec=" + llGetSubString(myGMTTime,17,18); llHTTPRequest(toUnix,[HTTP_METHOD,"GET"],""); } http_response(key request_id,integer status, list metadata, string body) { body = llGetSubString(body, 50, -9); //corrects HTTP response from server's Eastern to UTC integer timecorrect = (integer)body - 18000; llSay(0,myGMTTime + " converts to " + (string)timecorrect);
}
} </lsl>