Skip to content

Commit

Permalink
Merge pull request #160 from OFFIS-DAI/fix_utc
Browse files Browse the repository at this point in the history
scheduling: fix scheduling times in UTC timezone instead of local time
  • Loading branch information
rcschrg authored Feb 5, 2025
2 parents 7cc1c78 + bffc1a2 commit 0f38af0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mango/util/scheduling.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

import asyncio
import concurrent.futures
import datetime
import logging
from abc import abstractmethod
from asyncio import Future
from dataclasses import dataclass
from datetime import datetime, timezone
from multiprocessing import Manager
from multiprocessing.synchronize import Event as MultiprocessingEvent
from typing import Any
Expand Down Expand Up @@ -299,7 +299,9 @@ def __init__(

async def run(self):
while not self._stopped:
current_time = datetime.datetime.fromtimestamp(self.clock.time)
current_time = datetime.fromtimestamp(
self.clock.time, tz=timezone.utc
).replace(tzinfo=None)
after = self._recurrency_rule.after(current_time)
# after can be None, if until or count was set on the rrule
if after is None:
Expand Down

0 comments on commit 0f38af0

Please sign in to comment.