User:Vegas Silverweb/How to get the SL Time in Chatlog Format

From Second Life Wiki
< User:Vegas Silverweb
Revision as of 20:31, 20 April 2010 by Vegas Silverweb (talk | contribs) (Created page with 'There's some pretty terrible LSL implementations out there for getting the 24 hour time as reported by Second Life. There's no reason to use a list or conditionals. This one's Go...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

There's some pretty terrible LSL implementations out there for getting the 24 hour time as reported by Second Life. There's no reason to use a list or conditionals. This one's Good.

<lsl> string vsGetSLClock() {

   integer time = (integer) llGetWallclock(); 
   integer hours = time / 3600;
   integer minutes = (time / 60) % 60  ;
   return llGetSubString("0"+(string)hours,-2,-1)+":"+
   llGetSubString("0"+(string)minutes,-2,-1);
   }

</lsl>