I have a piece of python3 code, that calls a function at 22:00.
# Imports
from datetime import datetime, date, time, timedelta
import sched
use time.time()
in python2, it's analog to datetime.timestamp()
in python3
datetime.datetime.timestamp
IF you need for current datetime realization, see implementation of that in python3:
def timestamp(self):
"Return POSIX timestamp as float"
if self._tzinfo is None:
return _time.mktime((self.year, self.month, self.day,
self.hour, self.minute, self.second,
-1, -1, -1)) + self.microsecond / 1e6
else:
return (self - _EPOCH).total_seconds()
where _EPOCH = datetime(1970, 1, 1, tzinfo=timezone.utc)