def get_next_day_cutoff_seconds(hour):
"Return the next cutoff for a particular hour as seconds since epoch."
local_tz = tzlocal.get_localzone()
dt_cutoff = local_tz.localize(datetime.now().replace(minute=0, second=0, microsecond=0, hour=hour))
# TODO doesn't actually work. if it is 1 am then it doens't chose 4 am of the same day.
# dt_cutoff += timedelta(days=1)
epoch = datetime(1970, 1, 1, tzinfo=pytz.utc)
return (dt_cutoff - epoch).total_seconds()
评论列表
文章目录