Skip to content

Commit 0acb414

Browse files
committed
Small update
1 parent 1594368 commit 0acb414

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

pyneofile/pyfile.py

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

1069+
def format_ns_local(ts_ns, fmt='%Y-%m-%d %H:%M:%S'):
1070+
ts_ns = int(ts_ns)
1071+
sec, ns = divmod(ts_ns, 10**9)
1072+
dt = datetime.datetime.fromtimestamp(sec).replace(microsecond=ns // 1000)
1073+
base = dt.strftime(fmt)
1074+
ns_str = "%09d" % ns
1075+
return base + "." + ns_str
1076+
10691077
def CheckSumSupport(checkfor, guaranteed=True):
10701078
if(guaranteed):
10711079
try:

0 commit comments

Comments
 (0)