Onionr/static-data/official-plugins/wot/wot/timestamp.py

11 lines
339 B
Python
Raw Normal View History

2022-08-31 05:30:28 +00:00
from time import time
class WotTimestamp(int):
def __new__(cls, value: int):
value = int(value)
if value <= 0:
raise ValueError("Timestamp cannot be negative or zero")
elif value > time():
raise ValueError("Timestamp cannot be in the future")
return super().__new__(cls, value)