# A tool to keep track of asynchronous events on a calendar?

I've got an urban fantasy story set a few decades ago that heavily involves vampires and werewolves, and as such, when exactly the sun and moon were out on a given day is important information for me to know when telling the story. Of course, the issue is that this constantly changes due to various factors that don't precisely sync with the 24 hour clock or even a yearly calendar, causing the moon to be out at different times on different days on different years, which would be excruciatingly difficult to keep track of by hand. Thankfully, since the sun and moon are very real things and the subjects of intense study, there are websites that thoroughly keep track of these things throughout a huge amount of recorded history, and I can easily find out with a quick google search when exactly the sun and moon were out on a given day, what lunar phase it was, etc.

But the issue comes if I want to keep track of such things for something that doesn't exist.

Suppose, for example, I wanted to add a system to my setting where every 25 hours, time temporarily stops for an hour for almost everything in my setting that isn't magical. This would obviously mean that this event would happen at a different hour of the day every day, and keeping track of what time it would happen each day in a story that takes place over the course of months or even years would be... exhausting.

Is there some sort of tool out there that would let me keep track of this? Maybe some software designed for worldbuilders to make fictional calendars for sci-fi stories with their own fictional suns and moons and planets with their own rotations and revolutions?

### This is an entry-level coding task:

So you want something that counts in a pattern that doesn't line up with the days - ie, from input like this:

    events =
[
// Time stops every 25 hours, starting from 3am on day 0
{"name":"Time stops", "periodHours" : 25, "startDay" : 0, "startHour" : 3},

// There's free ice cream every 117 hours, starting from day 3 at 7pm
{"name":"Free ice cream", "periodHours" : 117, "startDay" : 3, "startHour" : 19},
];


will generate output like this?

....
Time stops at day 90 at 18:00
Free ice cream at day 91 at 13:00
Time stops at day 91 at 19:00
Time stops at day 92 at 20:00
Time stops at day 93 at 21:00
Time stops at day 94 at 22:00
Time stops at day 95 at 23:00
Free ice cream at day 96 at 10:00
Time stops at day 97 at 0:00
Time stops at day 98 at 1:00
Time stops at day 99 at 2:00
Time stops at day 100 at 3:00
Time stops at day 101 at 4:00
Free ice cream at day 101 at 7:00
Time stops at day 102 at 5:00
....


This is not a big programming task. It's 45 lines of javascript. Here is a live Demo - you can change the timing and add more events and pick an area of interest in that from a browser.

Source code:

    events =
[
// Time stops every 25 hours, starting from 3am on day 0
{"name":"Time stops", "periodHours" : 25, "startDay" : 0, "startHour" : 3},

// There's free ice cream every 117 hours, starting from day 3 at 7pm
{"name":"Free ice cream", "periodHours" : 117, "startDay" : 3, "startHour" : 19},
];

// Your interested in events 10 days either side of day 100
dayYouAreInterestedIn = 100;
daysAround = 10;

//////////////////////////////

timeline = [];

events.forEach(function (i, index)
{
counter = i.startDay + i.startHour / 24.0;

while(counter < dayYouAreInterestedIn - daysAround)
{
counter += i.periodHours / 24.0;
}

while(counter < dayYouAreInterestedIn + daysAround)
{
timeline.push([counter, i.name]);

counter += i.periodHours / 24.0;
}
});

timeline = timeline.sort(function(a, b) { return a[0] - b[0];});

timeline.forEach(function (i, index)
{
document.getElementById('o').innerHTML +=
i[1] + " at day " + Math.floor(i[0]) + " at " + Math.round((i[0] * 24) % 24) + ":00<br>";
});


This would be easy to achieve with a spreadsheet. Have normal hours in one column and 25 hours in a second. Copy each set of numbers down the column in a repeating pattern (or use formulas). A year or two should be manageable.

Various arrangements and elaborations can be made to this basic theme. For example the date could be included in another column, logic and conditional cells could be used to highlight particular occurrences and complex formula could be developed over multiple columns and hidden if required.