blob: efcee2942576220fb47a9bb32e73ca6b92f934d0 [file] [log] [blame]
Patrick Williams215c1c32022-01-06 20:26:26 -06001#!/usr/bin/python3
2from enum import Enum
3from datetime import datetime, timezone
4
5
6class TimeOfDay(Enum):
7 AM = 0
8 PM = 1
9
10
11def timestamp(date: str, time: TimeOfDay) -> int:
12 [year, month, day] = [int(x) for x in date.split("-")]
13
14 if time == TimeOfDay.AM:
15 [hour, minute, second] = [00, 00, 00]
16 else:
17 [hour, minute, second] = [23, 59, 59]
18
19 return int(
20 datetime(
21 year, month, day, hour, minute, second, tzinfo=timezone.utc
22 ).timestamp()
23 )