Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Simple clock

Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
06-10-2003 19:45
CODE

// Simple Clock
// Wednesday Grimm
// June 10, 2003
//
// A very simple clock.

integer SECONDS_PER_HOUR = 3600;
integer SECONDS_PER_MINUTE = 60;

integer second()
{
return (integer)llGetWallclock() % SECONDS_PER_MINUTE;
}
integer minute()
{
return ((integer)llGetWallclock()%SECONDS_PER_HOUR) / SECONDS_PER_MINUTE;
}
integer hour()
{
return (integer)llGetWallclock() / (integer)SECONDS_PER_HOUR;
}
default
{
state_entry()
{
// update the clock every second, it would be silly to
// do it more frequently
llSetTimerEvent(1.0);
}

timer()
{
vector colour = <1.0, 1.0, 0.0>; // a nice yellow

// Build the time string
llSetText(
(string)hour() + ":" +
(string)minute() + ":" +
(string)second(),
colour,
1.0);
}
}
_____________________
Sarcasm meter:
0 |-----------------------*-| 10
Rating: Awww Jeeze!
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
04-25-2005 08:57
/54/39/44198/1.html
_____________________
i've got nothing. ;)
Frazospazo Zamani
Uniqueness
Join date: 10 Nov 2007
Posts: 38
12-03-2007 10:37
I've got to say; that's a very simple Clock. :D
_____________________