Skip to content

Commit 3d67428

Browse files
committed
commit ALL the files
1 parent caa8b50 commit 3d67428

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

splitio/util/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""Utilities."""
2+
from datetime import datetime
3+
4+
5+
EPOCH_DATETIME = datetime(1970, 1, 1)
6+
7+
def utctime():
8+
"""
9+
Return the utc time in nanoseconds.
10+
11+
:returns: utc time in nanoseconds.
12+
:rtype: float
13+
"""
14+
return (datetime.utcnow() - EPOCH_DATETIME).total_seconds()
15+
16+
17+
def utctime_ms():
18+
"""
19+
Return the utc time in milliseconds.
20+
21+
:returns: utc time in milliseconds.
22+
:rtype: int
23+
"""
24+
return int(utctime() * 1000)

0 commit comments

Comments
 (0)