Bugfix for locations near the dateline

This commit is contained in:
2024-02-15 18:31:32 +01:00
parent 1c6060d8d5
commit 77db85cc71
3 changed files with 4 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
# Version 2.4 # Version 2.4
- Adding Login window support - Adding Login window support
- Adding Russian translation (Thanks to blogdron) - Adding Russian translation (Thanks to blogdron)
- Bugfix: Time period calculation on locations near the dateline, like Japan
# Version 2.3 # Version 2.3
- Adding Dutch translation - Adding Dutch translation

View File

@@ -2,7 +2,7 @@
from gi.repository import Gio, Gdk from gi.repository import Gio, Gdk
# Packages # Packages
import os, time, locale, subprocess, sys import os, time, locale, subprocess
from PIL import Image from PIL import Image
# Local scripts # Local scripts

View File

@@ -1,5 +1,5 @@
from math import pi, sin, asin, acos, cos, floor, atan, tan from math import pi, sin, asin, acos, cos, floor, atan, tan
from datetime import datetime, timezone, time from datetime import datetime, timezone, time, timedelta
class Suntimes: class Suntimes:
@@ -55,7 +55,7 @@ class Suntimes:
civial_dusk_start = self.calc_sunrise_sunset_time(False) civial_dusk_start = self.calc_sunrise_sunset_time(False)
night_start = self.calc_sunrise_sunset_time(False, 96) night_start = self.calc_sunrise_sunset_time(False, 96)
light_period_duration = (sunset_start - morning_start) / 8 light_period_duration = timedelta(seconds=(sunset_start - morning_start).seconds / 8)
noon_start = morning_start + 3 * light_period_duration noon_start = morning_start + 3 * light_period_duration
afternoon_start = morning_start + 5 * light_period_duration afternoon_start = morning_start + 5 * light_period_duration