Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

Commit

Permalink
Changed:time format
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjiaH committed Feb 27, 2021
1 parent 67af814 commit 09da782
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions common/service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import datetime

from datetime import datetime
from time import sleep, time
from common import security
from common.logger import logger
Expand All @@ -22,8 +21,8 @@ def __init__(self):
self._email_rxer = global_config.getRaw('messenger', 'email')

def _get_now_time(self):
now_time = datetime.datetime.now()
self._str_now_time = "{h}.{m}".format(h=now_time.hour, m=now_time.minute)
now = datetime.now()
self._str_now_time = now.strftime("%H.%M")
return self._str_now_time

def _single_mode(self):
Expand Down Expand Up @@ -71,13 +70,11 @@ def start(self):
logger.info("Set time mode enable.")
logger.info(
"Now time:{now_time}. Set time:{set_time}.".format(now_time=str_now_time, set_time=str_set_time))
# logger.info("Waiting...")
while True:
global_config.refresh()
if str_set_time != global_config.getRaw('config', 'set_time'):
str_set_time = global_config.getRaw('config', 'set_time')
logger.info("New set time:{set_time}.".format(set_time=str_set_time))
logger.info("Waiting...")
str_now_time = self._get_now_time()
if str_now_time != str_set_time:
# print(str_now_time)
Expand Down

0 comments on commit 09da782

Please sign in to comment.