Man calendar

From LSWiki

(Difference between revisions)
Jump to: navigation, search

Revision as of 17:55, 11 June 2007

Description

This file will detail the effects of the calendar. This will be a general outline of the structure of the Lost Souls calendar, the gtime() efun and the weather system (which are all tied together).

Each year on Lost Souls has 10 months, each month is comprised of 30 days, each day has 30 hours, and each hour is comprised of 60 minutes of 60 seconds each. All of these values are stored in /lib/time.h in the form of <Division>_Per_<Unit> (ie. Seconds_Per_Minute), and /lib/time.h also provides shortcut functions for conversions, the most important of w which is convert_date(), which accepts an integer in the form of gtime(), and converts it into an array of integers representing the year, month, etc. The position of the values in the array are defined to be DATE_YEAR, DATE_MONTH, DATE_DAY, DATE_HOUR, DATE_MINUTE, DATE_SECOND.

The former game clock has been converted from a primitive call_out mechanism to an algorithm based upon 'real' time. As a result, all of the functionality that the game clock provided can be handled by calling the new efun gtime() and using the values stored in /lib/time.h to calculate any value you think you need.

Below are old functions from game_clock.c (now retired), what they did, and the modern equivalent.

  [ query_season(),  query_moon(), and  query_night() are in
   the weather daemon now.]
query_month() - Returns numerical month value.
  to_int(cgtimef("%l",gtime()));
query_month_s() - Returns month name.
  cgtimef("%M",gtime());
query_day() - Returns numerical day of the month.
  to_int(cgtimef("%d",gtime()));
query_year() - Returns year.
  to_int(cgtimef("%y",gtime()));
query_date() - Returns date as mm/dd/yy.
  cgtimef("%l/%d/%y",gtime());
query_date_s() - Returns date as Mm dd, yy.
  cgtimef("%M %d, %y",gtime());
query_minute() - Returns minutes past the hour.
  to_int(cgtimef("%m",gtime()));
query_hour() - Returns hour in 30 hour cycle.
  to_int(cgtimef("%h",gtime()));
query_15_hour() - Returns hour in 15 hour cycle.
  to_int(cgtimef("%H",gtime()));
query_10_hour() - Returns hour in 10 hour cycle.
  to_int(cgtimef("%g",gtime()));
query_am() - Returns true if am.
  (cgtimef("%D",gtime())==AMPM15[0]); 
query_pm() - Returns true if pm.
  (cgtimef("%D",gtime())==AMPM15[1]);
query_noon() - Returns true if noon.
  ( query_30_hour()==(Hours_Per_Day/2-1)&&! query_minute());
query_midnight() - Returns true if midnight.
  ( query_30_hour()==0&&! query_minute());
query_time() - Returns time in 30 hour cycle.
  cgtimef("%T",gtime());
query_time_10() - Returns time in 10 hour cycle.
  cgtimef("%I",gtime());
query_time_15() - Returns time in 15 hour cycle.
  cgtimef("%i",gtime());
query_abs_day() - Returns day number since start of calendar system.
  gtime()/Minutes_Per_Day;

SEE ALSO cgtime(efun), cgtimef(efun), gtime(efun), time(build), weather(concept)

Personal tools