Skip to content

Commit

Permalink
GH #755 - Adding utcnow_from_ns.
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuch committed Dec 9, 2024
1 parent 53c98d8 commit 812f355
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion code/zato-common/src/zato/common/util/time_.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# stdlib
from datetime import datetime, timedelta, timezone
from time import time
from time import time, time_ns
import logging

# Arrow
Expand Down Expand Up @@ -84,6 +84,11 @@ def utcnow_as_ms(_time=time):

# ################################################################################################################################

def utcnow_from_ns():
return time_ns() // 1_000_000

# ################################################################################################################################

def datetime_from_ms(ms:'float', isoformat:'bool'=True) -> 'str | datetime':
""" Converts a number of milliseconds since UNIX epoch to a datetime object.
"""
Expand Down

0 comments on commit 812f355

Please sign in to comment.