# Time 12, Exercise 3: sidereal day, decimal time and the 13-month fixed calendar # Part 1: sidereal day. In one year the Earth turns once more relative to the stars # than the Sun appears to cross the sky. solar_days = 365.2422 sidereal_days = solar_days + 1 sidereal_day = 86400 * solar_days / sidereal_days h, rest = divmod(sidereal_day, 3600) m, s = divmod(rest, 60) print("sidereal days in a year:", sidereal_days) print("sidereal day:", round(sidereal_day, 1), "s =", int(h), "h", int(m), "min", round(s, 1), "s") # Part 2: French Revolutionary decimal time: 10 hours, 100 minutes, 100 seconds def to_decimal(hh, mm, ss): fraction = (hh * 3600 + mm * 60 + ss) / 86400 dsecs = fraction * 100_000 dh, rest = divmod(dsecs, 10_000) dm, ds = divmod(rest, 100) return int(dh), int(dm), round(ds) print("decimal second lasts", 86400 / 100_000, "ordinary seconds") print("15:00:00 is", to_decimal(15, 0, 0), "decimal") print("06:00:00 is", to_decimal(6, 0, 0), "decimal") print("18:30:00 is", to_decimal(18, 30, 0), "decimal") # Part 3: International Fixed Calendar: 13 months of 28 days, plus one extra day print("13 x 28 + 1 =", 13 * 28 + 1) def fixed_date(day_of_year): if day_of_year == 365: return "Year Day" month, day = divmod(day_of_year - 1, 28) return f"month {month + 1}, day {day + 1}" for d in (1, 28, 29, 200, 365): print("day", d, "->", fixed_date(d)) # Output when run: # sidereal days in a year: 366.2422 # sidereal day: 86164.1 s = 23 h 56 min 4.1 s # decimal second lasts 0.864 ordinary seconds # 15:00:00 is (6, 25, 0) decimal # 06:00:00 is (2, 50, 0) decimal # 18:30:00 is (7, 70, 83) decimal # 13 x 28 + 1 = 365 # day 1 -> month 1, day 1 # day 28 -> month 1, day 28 # day 29 -> month 2, day 1 # day 200 -> month 8, day 4 # day 365 -> Year Day # Reading the output: 15:00 is 62.5% of the day, which is 6 decimal hours and 25 decimal # minutes. The fixed calendar makes every month identical, so the 29th day of the year is # always the 1st of month 2; the cost is the extra day outside the week, and thirteen months.