Attic calendar calculator

Posted Thargelion 3, Ol.700.3. Last updated Skirophorion 29, Ol.700.3.

Leer en español...

attic.c

attic.c is a C program that displays the current date of the Attic calendar (the moon-phase-based festival calendar used in ancient Athens) on the terminal without the need for online services. It's a C port of Xanthe's Javascript algorithm, with many additions of my own. The program uses the SunCalc library that I also translated to C (or at least the parts that I needed).

By default the program calculates solstices and new moons at dawn from your location, not Athens. This can be changed in the settings but it's a key difference from Xanthe's algorithm that you need to keep in mind. I made this change because I consider it more meaningful if the lunisolar date reflects the local sky. This obviously means that the date may not the same everywhere because new moons happen at different times of the day around the world (even though new moons happen at the same instant worldwide).

Days start at sunset. This can be changed in the settings so days start at sunrise or midnight, to taste.

Because it relies on computing sunsets, the program might not work as expected within the polar circles.

Use attic.c alongside hora.c to be aware of the current planetary hour as well.

There might be inaccuracies in the calculations and bugs in the code. In no way is attic.c supposed to be authoritative, so use the program at your own risk.

Usage

To use attic.c, download the source files

  1. attic.c
  2. suncalc.c
  3. suncalc.h

and compile the program with cc -o attic attic.c suncalc.c -lm. When run without arguments, the current date on the Attic calendar will be displayed in the format Ol.(olympiad).(year of the olympiad) (month name) (day of the month):

Ol.700.3 Thargelion 3

Options

-r: The Attic date is displayed raw (olympiad year month day) with values separated by spaces useful for parsing with other programs. Here the month is a 0-indexed value going from 0 to 12 starting from Hekatombaiōn. 6 is always the intercalary month Poseideōn II, so 7 is Gamēliōn and so on.

700 3 11 3

-i: The Attic date is displayed in pseudo-ISO 8601 format (OOO-Y-MM-DD). In this case the months go from 1 to 12 as usual, but on a leap year with 13 months the intercalary month Poseideōn II is displayed as 06.2.

700-3-11-03

-a: The Attic date is displayed as without options, but the month name is abbreviated.

Ol.700.3 Tha. 3

Settings

If you need to change the program's settings, modify the source code and recompile it. The following macros alter the behavior of the program:

Comments? Tell me what you think in the guestbook.