Skip to content

Commit 5b0b103

Browse files
committed
Small update
1 parent 0ff8c3f commit 5b0b103

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

pycatfile/pyfile.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,14 @@ def format_ns_utc(ts_ns, fmt='%Y-%m-%d %H:%M:%S'):
10721072
ns_str = "%09d" % ns
10731073
return base + "." + ns_str
10741074

1075+
def format_ns_local(ts_ns, fmt='%Y-%m-%d %H:%M:%S'):
1076+
ts_ns = int(ts_ns)
1077+
sec, ns = divmod(ts_ns, 10**9)
1078+
dt = datetime.datetime.fromtimestamp(sec).replace(microsecond=ns // 1000)
1079+
base = dt.strftime(fmt)
1080+
ns_str = "%09d" % ns
1081+
return base + "." + ns_str
1082+
10751083
def CheckSumSupport(checkfor, guaranteed=True):
10761084
if(guaranteed):
10771085
try:

0 commit comments

Comments
 (0)