Skip to content

Commit ec45fbd

Browse files
Add files via upload
1 parent da65dbe commit ec45fbd

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

pycatfile.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):
@@ -652,7 +658,7 @@ def _get(section_dict, key, default=None):
652658
__version_date__ = str(__version_date_info__[0]) + "." + str(
653659
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
654660
__revision__ = __version_info__[3]
655-
__revision_id__ = "$Id: 7aaec01a72206a228de14a72ac493120336e9ca3 $"
661+
__revision_id__ = "$Id$"
656662
if(__version_info__[4] is not None):
657663
__version_date_plusrc__ = __version_date__ + \
658664
"-" + str(__version_date_info__[4])
@@ -1051,6 +1057,14 @@ def to_ns(timestamp):
10511057
# Multiply by 1e9 to get nanoseconds, then cast to int
10521058
return int(seconds * 1000000000)
10531059

1060+
def format_ns_utc(ts_ns, fmt='%Y-%m-%d %H:%M:%S'):
1061+
ts_ns = int(ts_ns)
1062+
sec, ns = divmod(ts_ns, 10**9)
1063+
dt = datetime.datetime.utcfromtimestamp(sec).replace(microsecond=ns // 1000)
1064+
base = dt.strftime(fmt)
1065+
ns_str = "%09d" % ns
1066+
return base + "." + ns_str
1067+
10541068
def _split_posix(name):
10551069
"""
10561070
Return a list of path parts without collapsing '..'.

0 commit comments

Comments
 (0)