Attic calendar calculator
Posted Thargelion 3, Ol.700.3. Last updated Skirophorion 29, Ol.700.3.
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
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:
LATITUDE
: Your location's latitude.LONGITUDE
: Your location's longitude.HEIGHT
: Your location's height above sea level, in meters. You can leave it as 0 or give it a more precise value for slightly better computations.LAT_ATHENS
: Athens' latitude.LNG_ATHENS
: Athens' longitude.HGT_ATHENS
: Athens' height above sea level, in meters. You can leave it as 0 or give it a more precise value for slightly better computations.USE_NORTHERN_NEW_YEAR
: If set to 0, the new year will start after the solstice in December. Otherwise (the default setting), the new year will start after the solstice in June. You might want to set this to 0:- If you live in the southern hemisphere and want the months to align with the same seasons as in the northern hemisphere (for example, you want Hekatombaiōn to align with the start of summer in December).
- Or if you simply consider that the year should start in winter instead of summer (or vice versa).
USE_ATHENS_TIMES
: If set to 1, Athens' coordinates as set in theLAT_ATHENS
,LNG_ATHENS
andHGT_ATHENS
macros will be used to compute the dates of solstices and new moons. Otherwise (the default setting), the coordinates set in theLATITUDE
,LONGITUDE
andHEIGHT
macros will be used instead.DAY_START
: Determines when days start. Can take three values:MIDNIGHT
: Days start at midnight.SUNRISE
: Days start at sunrise.SUNSET
: Days start at sunset (default setting).
EPOCH
: Defines the year of the first olympiad. The default value is -775 (776 BC). For example, you can set it to 0 to start counting olympiads from 1 BC and have a Christian Attic calendar. An interesting thought for sure!