Skip to content

Commit

Permalink
fix date time utcnow() to just now()
Browse files Browse the repository at this point in the history
using utcnow() means it does not give the date of the device and if the date changes on the device, the scheduled jobs won't run;
  • Loading branch information
zaytiri committed Mar 26, 2023
1 parent d3e3aaa commit 8e51eeb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion progscheduler/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def is_time_to_stop_valid(program_name, time_to_stop):


def is_scheduled_today(days_to_schedule):
now = datetime.utcnow()
now = datetime.now()
return now.strftime("%A").lower() in days_to_schedule


Expand Down
2 changes: 1 addition & 1 deletion progscheduler/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def open_program(root_path):
now = datetime.utcnow()
now = datetime.now()
os.startfile(root_path)
show('The following file \n\t\t\t\'' + root_path + '\'\n\t\t has started at ' + str(now.hour).zfill(2) + ':' + str(now.minute).zfill(2) + ':' + str(
now.second).zfill(2) + '.')
2 changes: 1 addition & 1 deletion progscheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ def __schedule_method(self, time_to_schedule, day='everyday'):

def __get_now_date(self):
self.__seconds_delay += 1
now = datetime.utcnow() + timedelta(seconds=self.__seconds_delay)
now = datetime.now() + timedelta(seconds=self.__seconds_delay)
return str(now.hour).zfill(2) + ':' + str(now.minute).zfill(2) + ':' + str(now.second).zfill(2)

0 comments on commit 8e51eeb

Please sign in to comment.