Skip to content

Commit

Permalink
drawreq: Change time unit to datetime
Browse files Browse the repository at this point in the history
Signed-off-by: Peace Lee <[email protected]>
  • Loading branch information
iipeace committed Jul 25, 2021
1 parent b0db29e commit eada54b
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions guider/guider.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
print("[ERROR] fail to import essential packages: %s" % err.args[0])
sys.exit(0)

# to convert an unsupported type #
# convert an unsupported type #
try:
long
except:
long = int

# to prevent MemoryError in python2 #
# prevent MemoryError in python2 #
try:
xrange
except:
Expand Down Expand Up @@ -33113,6 +33113,8 @@ def checkCmdMode():
elif SysMgr.checkMode('req'):
SysMgr.setStream()

SysMgr.printLogo(big=True, onlyFile=True)

SysMgr.doRequest()

# SETCPU MODE #
Expand Down Expand Up @@ -36733,10 +36735,27 @@ def _drawMeta(labelList=None):
# set xticks #
try:
xtickLabel = ax.get_xticks().tolist()
xtickLabel = list(map(long, xtickLabel))

try:
datetime = SysMgr.getPkg('datetime')

# convert time unit #
for idx, item in enumerate(xtickLabel):
ms = item % 1000
value = datetime.datetime.utcfromtimestamp(item/1000)
xtickLabel[idx] = value.strftime('%H:%M:%S')
xtickLabel[idx] = '%s.%0.3d' % (xtickLabel[idx], ms)
except SystemExit:
sys.exit(0)
except:
SysMgr.printWarn(
'fail to convert time unit in xticks', reason=True)

xtickLabel[-1] = 'Time'
ax.set_xticks(ax.get_xticks())
ax.set_xticklabels(xtickLabel)
except SystemExit:
sys.exit(0)
except:
pass

Expand Down

0 comments on commit eada54b

Please sign in to comment.