blob: 6139fd528a960cfb6f9817c1d12b41f89a7d9077 [file] [log] [blame]
Patrick Williams215c1c32022-01-06 20:26:26 -06001#!/usr/bin/python3
Patrick Williams215c1c32022-01-06 20:26:26 -06002from datetime import datetime, timezone
Patrick Williamse310dd92022-12-07 06:55:38 -06003from enum import Enum
Patrick Williams215c1c32022-01-06 20:26:26 -06004
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 )