gameclock

daemons
OBJECT
	/p/daemons/gameclock


SYNOPSIS
	GAMECLOCK->...


LAST UPDATE
	Mateese, 09-Jun-96 02:00 MET


DESCRIPTION
	The gameclock is demon to compute the uptime and decent
	descriptions for the current daystate. It also implements the
	Clocktower function ("You hear the Clocktower from afar...").
	It can not be cloned or moved.

	The object offers these functions:

	  string QueryDaytime ()
	    Returns a descriptive string for the daytime, according to
	    the global nightday server (e.g. "noon", "night").
	    If the daytime cannot be determined for some reason, 0 is
	    returned.

	  mixed * QueryUptime ()
	    Returns an array holding the uptime in a readable format.
	    If the uptime cannot be determined, 0 is returned.
	    The array has basically this format:
	      ({ <number of days>   , "days"
	       , <number of hours>  , "hours"
	       , <number of minutes>, "minutes"
	       , <number of seconds>, "seconds"
              })
            but with two deviations: if one entry is just one unit
            (e.g. one minute), the string uses the singular form,
	    and leading zero entries are omitted. The 'seconds' entry
	    is always present.
	    Examples:
	      ({ 1, "day", 10, "hours", 3, "minutes", 2, "seconds" })
	      ({            3, "hours", 0, "minutes", 1, "second"  })
	      ({                                      0, "seconds" })


	The Clocktower feature is implemented with this function:

	  public void Bing (int when) 
	    Function implementing the Clocktower functionality. It
	    calls itself in a call_out(), passing the nominal time of
	    the scheduled call (to detect if the call happens too
	    early). 
	    Upon call, the function converts the current time into a
	    nice string and prints it to all players, then it schedules
	    a call to itself for the next full hour (unless there is
	    no active player online).

	The Clocktower is started by a call to

	  public void StartBing()
	    Setup the first call_out() to Bing() if there is none
	    at the moment.

	This function is called from /std/player upon every login, as
	well as from the gameclock's create().


INHERITANCE TREE
        gameclock


SEE ALSO