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

From Second Life Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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>