mirror of
https://github.com/283375/arcaea-offline.git
synced 2025-04-21 15:00:18 +00:00
feat(utils): Kanae day/night util
This commit is contained in:
parent
7c000d01cb
commit
c7de60ee03
15
src/arcaea_offline/utils/partner.py
Normal file
15
src/arcaea_offline/utils/partner.py
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
from enum import IntEnum
|
||||||
|
|
||||||
|
|
||||||
|
class KanaeDayNight(IntEnum):
|
||||||
|
Day = 0
|
||||||
|
Night = 1
|
||||||
|
|
||||||
|
|
||||||
|
def kanae_day_night(timestamp: int) -> KanaeDayNight:
|
||||||
|
"""
|
||||||
|
:param timestamp: POSIX timestamp, which is passed to `datetime.fromtimestamp(timestamp)`.
|
||||||
|
"""
|
||||||
|
dt = datetime.fromtimestamp(timestamp)
|
||||||
|
return KanaeDayNight.Day if 6 <= dt.hour <= 19 else KanaeDayNight.Night
|
Loading…
x
Reference in New Issue
Block a user