Skip to content

Commit 27b99c8

Browse files
Add files via upload
1 parent d8c2ab7 commit 27b99c8

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

pyarchivefile.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,13 @@ def _is_printable(ch):
444444
else:
445445
prescriptpath = get_importing_script_path()
446446
if(prescriptpath is not None):
447-
scriptconf = os.path.join(os.path.dirname(prescriptpath), __use_ini_name__)
447+
if(__use_ini_file__ and not __use_json_file__):
448+
scriptconf = os.path.join(os.path.dirname(prescriptpath), __use_ini_name__)
449+
elif(__use_json_file__ and not __use_ini_file__):
450+
scriptconf = os.path.join(os.path.dirname(prescriptpath), __use_json_name__)
451+
else:
452+
scriptconf = ""
453+
prescriptpath = None
448454
else:
449455
scriptconf = ""
450456
if os.path.exists(scriptconf):
@@ -646,7 +652,7 @@ def _get(section_dict, key, default=None):
646652
__version_date__ = str(__version_date_info__[0]) + "." + str(
647653
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
648654
__revision__ = __version_info__[3]
649-
__revision_id__ = "$Id: 6175e8bfecf10c0bc4f7dcd8aa08a1378335e2d2 $"
655+
__revision_id__ = "$Id$"
650656
if(__version_info__[4] is not None):
651657
__version_date_plusrc__ = __version_date__ + \
652658
"-" + str(__version_date_info__[4])
@@ -1045,6 +1051,14 @@ def to_ns(timestamp):
10451051
# Multiply by 1e9 to get nanoseconds, then cast to int
10461052
return int(seconds * 1000000000)
10471053

1054+
def format_ns_utc(ts_ns, fmt='%Y-%m-%d %H:%M:%S'):
1055+
ts_ns = int(ts_ns)
1056+
sec, ns = divmod(ts_ns, 10**9)
1057+
dt = datetime.datetime.utcfromtimestamp(sec).replace(microsecond=ns // 1000)
1058+
base = dt.strftime(fmt)
1059+
ns_str = "%09d" % ns
1060+
return base + "." + ns_str
1061+
10481062
def _split_posix(name):
10491063
"""
10501064
Return a list of path parts without collapsing '..'.

0 commit comments

Comments
 (0)