| Conditions | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | import time |
||
| 9 | def run(self, date=None): |
||
| 10 | if date: |
||
| 11 | dt = isotime.parse(date) |
||
| 12 | else: |
||
| 13 | dt = datetime.datetime.utcnow() |
||
| 14 | |||
| 15 | start_dt = (dt - datetime.timedelta(days=dt.weekday())) |
||
| 16 | end_dt = (start_dt + datetime.timedelta(days=6)) |
||
| 17 | start_dt = start_dt.replace(hour=0, minute=0, second=0, microsecond=0) |
||
| 18 | end_dt = end_dt.replace(hour=23, minute=59, second=59, microsecond=0) |
||
| 19 | |||
| 20 | start_timestamp = int(time.mktime(start_dt.timetuple())) |
||
| 21 | end_timestamp = int(time.mktime(end_dt.timetuple())) |
||
| 22 | |||
| 23 | return start_timestamp, end_timestamp |
||
| 24 |