Times & Dates

Calculation

Time pass a little differently in the world of Glitch. There are still 24 hours in a day, and 60 minutes in an hour, but a minute lasts only 10 real-world seconds. This means that each game day takes exactly 4 real-world hours.

Calculating the current date is a little more complicated. A Glitch year has 11 months and 1 special day that falls outside of any month. For calculation, you can treat this special day as a month that lasts for only 1 day. The months are as follows:

Primuary 29 days
Spork 3 days
Bruise 53 days
Candy 17 days
Fever 73 days
Junuary 19 days
Septa 13 days
Remember 37 days
Doom 5 days
Widdershins 47 days
Eleventy 11 days
Recurse (1 day)

With these months, we get 308 days in a year. Glitch weeks are 8 days long, as you would expect.

  • Hairday
  • Moonday
  • Twoday
  • Weddingday
  • Theday
  • Fryday
  • Standday
  • Fabday

Recurse is not part of the regular week, so if the 11th of Eleventy is a Moonday, then the 1st of Primuary will be a Twoday.

All that you need after that is the start of the current calendar, which occurred at Unix timestamp 1238562000, better known as 5am UTC on April 4th, 2009 (midnight Eastern Standard Time).

Example Code

Here's some PHP code for calculating the current game date and time. If you adapt this into other languages, let us know and we'll put it here too.

#
# how many real seconds have elapsed since game epoch?
#

$sec = $ts - 1238562000;


#
# there are 4435200 real seconds in a game year
# there are 14400 real seconds in a game day
# there are 600 real seconds in a game hour
# there are 10 real seconds in a game minute
#

$year = floor($sec / 4435200);
$sec -= $year * 4435200;

$day_of_year = floor($sec / 14400);
$sec -= $day_of_year * 14400;

$hour = floor($sec / 600);
$sec -= $hour * 600;

$minute = floor($sec / 10);
$sec -= $minute * 10;


#
# turn the 0-based day-of-year into a day & month
#

list($month, $day_of_month) = day_to_md($day_of_year);


#
# get day-of-week
#

$days_since_epoch = $day_of_year + (307 * $year);

$day_of_week = $days_since_epoch % 8;



function day_to_md($id){

	$months = array(29, 3, 53, 17, 73, 19, 13, 37, 5, 47, 11, 1);
	$cd = 0;

	for ($i=0; i<count($months); $i++){
		$cd += $months[$i];
		if ($cd > $id){
			$m = $i+1;
			$d = $id+1 - ($cd - $months[$i]);
			return array($m, $d);
		}
	}

	return array(0, 0);
}

Holidays

The Glitch calendar contains a number of holidays, which commemorate special events in the history of the world. There is an API method to fetch the current holiday dates, calendar.getHolidays. The current holidays are as follows:

5th Primuary AlphCon
2nd Spork Lemadan
3rd Bruise Pot Twoday
2nd-4th Candy Root
11th Candy Sprinkling
17th Junuary Croppaday
1st Septa Belabor Day
37th Remember Zilloween
11th Eleventy Recurse Eve

The Ur holidays and special dates commission are a fickle bunch, so use the API for the latest dates.