diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/c/event.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/c/event.c b/src/c/event.c index 59fdb98..55b1041 100644 --- a/src/c/event.c +++ b/src/c/event.c @@ -687,11 +687,16 @@ void update_event_index() { } int minutes_to_event(const struct Gw2Event *event) { + static const int minutes_in_day = 60 * 24; const time_t now = time(NULL); const struct tm *utc = gmtime(&now); const int utc_offset = utc->tm_hour * 60 + utc->tm_min; - return event->utc_offset - utc_offset; + int minutes = event->utc_offset - utc_offset; + if (minutes < 0) { + minutes += minutes_in_day; + } + return minutes; } GColor8 color_for_category(enum Category category) { |
