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

From Second Life Wiki
Jump to: navigation, 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>