aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar jesopo2019-11-15 12:13:16 +0000
committerGravatar jesopo2019-11-15 12:13:16 +0000
commit2cb55306c3155a317223a500f814259e77445325 (patch)
tree841f71805d826103b506ea3ed21d492177e9d231 /src
parentimplement opt-in shlex for command args (diff)
signature
show first-words datestamp on !words output
Diffstat (limited to 'src')
-rw-r--r--src/utils/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/utils/__init__.py b/src/utils/__init__.py
index 477d8e59..33ad449b 100644
--- a/src/utils/__init__.py
+++ b/src/utils/__init__.py
@@ -18,6 +18,9 @@ DATE_HUMAN = "%Y-%m-%d"
def datetime_utcnow() -> datetime.datetime:
return datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc)
+def datetime_timestamp(seconds: float) -> datetime.datetime:
+ return datetime.datetime.fromtimestamp(seconds).replace(
+ tzinfo=datetime.timezone.utc)
def iso8601_format(dt: datetime.datetime, milliseconds: bool=False) -> str:
dt_format = dt.strftime(ISO8601_FORMAT_DT)