Name the text-file helpers for what they hold, and keep what counts as a quote beside the judge
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import calendar
|
||||
import time
|
||||
|
||||
STAMP = "%Y-%m-%dT%H:%M:%SZ"
|
||||
STAMPED = r"\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ"
|
||||
|
||||
|
||||
def utc(at: float) -> str:
|
||||
return time.strftime(STAMP, time.gmtime(at))
|
||||
|
||||
|
||||
def seconds(stamp: str) -> int:
|
||||
"""The seconds since the epoch that stamp names, read in utc's format. Raises ValueError where time.strptime cannot read it so."""
|
||||
return calendar.timegm(time.strptime(stamp, STAMP))
|
||||
Reference in New Issue
Block a user