NAME 
	/obj/daemon/timed.c - NannyMUD local time daemon

DESCRIPTION

	timed.c The local NannyMUD time.

	The idea is simply to have the 'normal' day converted in to small
	'Nannydays' each of these days 19 real hours, with 2 hours of night.
		A NannyMinute is 23 seconds.
		A NannyHour is 58 NannyMinutes.
		A NannyDay is 19 NannyHours.
		A Nannyweek is 7 Nannydays.
		A Nannymonth is 21 Nannydays. This is 3 Nannyweeks.
		A Nanny Year is 13 Nannymonths.
		A Mooncycle is completed in 8 Nannydays.
		Years have their own names, wich are repeated in cycles 
		of 17 years.

	The start for for the Nannytime is when Nanny was first started,
	in April 25, 1990.

NOTA BENE
	So, why do we bother with this?
	Well, it would add a new dimension to the game, and thus make it
	more fun to play it. The idea is to let certain powers be better
	at certain times, a classic example is of course were-creatures.


SETUP FUNCTIONS
	None.

NAME FUNCTIONS
	_name_of_year
	_name_of_month
	_name_of_day

ABSOULUTE DATE FUNCTIONS
	_year
	_month
	_mday
	_weekday
	nanny_time2
    	_ctime
	_time_of_day
	_part_of_day

RELATIVE TIME FUNCTIONS
	dtime
	_dtime
	_time
	nanny_time

MISC FUNCTIONS
	_phase


=========================================================================

NAME
	_name_of_year - Give the name of a year.

SYNTAX
	string _name_of_year(int year)

DESCRIPTION
	Year names are cyclic, and repeated every 17 years. This function
	returns the correct name for every year in the range [0..MAX_INT].
	The following names are used:

    		The Year of Creation
    		The Year of the Daemon
		The Year of the Wind
		The Year of the Dragon
		The Year of the Giants
		The Year of the Elves
		The Year of Magic
		The Year of Humans
		The Year of the Golden Age
		The Year of Sacrilage
		The Year of Darkness
		The Year of Blood
		The Year of Sacrifice
		The Year of Purification
		The Year of Light
		The Year of Balance

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_name_of_year(TD->_year(TD->_time())));

=========================================================================

NAME
	_name_of_month

SYNTAX
	string _name_of_month(int month)

DESCRIPTION
	Returns the name of the month. The following names are used:

		The Month of Darkness
		The Month of Truth
		The Month of Wind
		The Month of Water
		The Month of Spirit
		The Month of Fertility
		The Month of Plant
		The Month of Earth
		The Month of Harmony
		The Month of Fire
		The Month of Illusion
		The Month of Law
		The Month of Demons

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_name_of_month(TD->_month(TD->_time())));

=========================================================================

NAME
	_name_of_day

SYNTAX
	string _name_of_day(int day)

DESCRIPTION
	Returns the name of the day. The following names are used:

		Larsday
		Q'sday
		Padsday
		Orsday
		Harday
		Leoday
		Matsday

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_name_of_day(TD->_weekday(TD->_time())));

=========================================================================

NAME
	_year

SYNTAX
	mixed _year(int i, int flag, int give_str)
	
DESCRIPTION
	This function returns what year it is. Set flag to convert to 
	Nanny Time (tm). Set give_str to get the name of the year.

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_year(TD->_time(), 1, 0)); /* writes the year-number */
	write(TD->_year(TD->_time(), 1, 1)); /* writes the year-name */

=========================================================================

NAME
	_month

SYNTAX
	mixed _month(int i, int flag, int give_str)
	
DESCRIPTION
	Returns the present month, beginning with month. 1 Set flag 
	to convert to Nanny Time (tm). Set give_str to get the name of 
	the month.

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_month(TD->_time(), 1, 0)); /* Gives a number */
	write(TD->_month(time(), 0, 0));      /* Same as above  */
	write(TD->_month(time(), 0, 1));      /* Gives a name   */

=========================================================================

NAME
	_mday

SYNTAX
	int _mday(int i, int flag)
	
DESCRIPTION
	Returns the day of the present month, beginning with day 1. Set flag 
	to convert to Nanny Time (tm).

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_mday(TD->_time(), 1));

=========================================================================

NAME
	_weekday

SYNTAX
	mixed _weekday(int i, int flag, int str)
	
DESCRIPTION
	Returns the present day of week, beginning with day 1. Set flag 
	to convert to Nanny Time (tm). Set give_str to get the name of 
	the month.

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_weekday(TD->_time(), 1, 0)); /* Gives a number */
	write(TD->_weekday(time(), 0, 0));      /* Same as above  */
	write(TD->_weekday(time(), 0, 1));      /* Gives a name   */

=========================================================================

NAME
	nanny_time2

SYNTAX
	int nanny_time2()
	
DESCRIPTION
	Prints some assorted time info.

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->nanny_time());
	/* prints:
	   Wed Oct  4 10:50:24 1995
	   Larsday The Month of Darkness 01  6:50:24 The Year of Light
	   31 years 0 month 0 day 6 hours 50 minutes 24 seconds.
	   Phase : Full moon
	*/

=========================================================================

NAME
	_ctime

SYNTAX
	string _ctime(int time)
	
DESCRIPTION
	Converts an integer with NannyTime(tm) to a formatted string
	with the absolute date.
	Similar to the efun ctime(), but uses NannyTime(tm).

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_ctime(time()));
	/* prints something in this format:
		Q'sday The Month of Darkness 02  0:27:59 The Year of Light
	*/

=========================================================================

NAME
	_dtime

SYNTAX
	string _dtime(int i)
	
DESCRIPTION
	Converts an integer with NannyTime(tm) to a formatted string
	with relative time.

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_dtime(this_player()->query_age()));
	/* prints something in this format:
	   1 year 3 months 8 days 1 hour 26 minutes 43 seconds
	*/

=========================================================================

NAME
	_time_of_day

SYNTAX
	mixed _time_of_day(int time, int flag, int give_str)
	
DESCRIPTION
	Converts an integer with NannyTime(tm) to a formatted string
	with the time of day. Set flag to convert time into NannyTime(tm).
	If give_str is 0, _time_of_day(...) returns an array ({hh, mm, ss}),
	else it returns a string: 8:50:16.

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_time_of_day(time(), 1, 1));
	/* prints something in this format:
	   8:50:16
	*/

=========================================================================

NAME
	_part_of_day

SYNTAX
	mixed _part_of_day(int time, int flag, int give_str)
	
DESCRIPTION
	Converts an integer with NannyTime(tm) to a formatted string
	wich tells if it is day or night or morning etc. Set flag to 
	convert time into NannyTime(tm).

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_part_of_day(time(), 1, 1));
	/* prints something in this format:
	   noon
	*/
	write(TD->_part_of_day(time(), 1, 0));
	/* prints something in this format:
	   5
	*/

=========================================================================

NAME
	dtime

SYNTAX
	string dtime(int i)
	
DESCRIPTION
	Converts an integer with RLTime(tm) to a formatted string
	with relative time.

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->dtime(this_player()->query_age()));
	/* prints something in this format:
	   17 days 6 hours 46 minutes 53 seconds
	*/

=========================================================================

NAME
	_time

SYNTAX
	int _time()
	
DESCRIPTION
	Returns the number of seconds since NannyMUD was first started.
	Very similar to the efun time().

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_time());
	/* prints something in this format:
	   172765898
	*/

=========================================================================

NAME
	nanny_time

SYNTAX
	void nanny_time(int time, int flag)
	
DESCRIPTION
	Writes the time in a formatted way. Set flag if i is not in 
	NannyTime(tm) already.

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->nanny_time(time(), 1);
	/* prints something in this format:
	   31 years 0 months 4 days 5 hours 32 minutes 2 seconds.
	*/

=========================================================================

NAME
	_phase

SYNTAX
	mixed _phase(int time, int flag, int give_str)
	
DESCRIPTION
	This function returns the moon-phase of Nanny's moon. time is 
	an int of the time when moon-phase is to be calculated. Set flag 
	if time is not in NannyTime(tm) already. If give_str is 1, _phase
	will return a string.

MOONCYCLES
   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
   F 3 H 1 E 1 H 3 F  3  H  1  E  1  H  3  F  3  H  1  E  1  H  3  F  3  H  1
   0 1 2 3 4 5 6 7 0  1  2  3  4  5  6  7    
   F == Full, H == Half, E == Empty 1= 1 Quarter full, 3 = 3 Quarters full

	By define is : Day One is a Full moon night.

EXAMPLE
	#define TD "/obj/daemon/timed"
	write(TD->_phase(time(), 1, 1); 
		/* prints: Three quarters full moon, declining */
	write(TD->_phase(time(), 1, 0); /* prints: 1 */
 
=========================================================================

Help topics available:
area_d.doc examples/ reclaimd.doc timed.doc wedd.doc

[START|BACK ]




[ NannyMuds main page | FAQ | Contact us ]

You are guest number 106 since March 2020.
This file was last modified: June 2000.