Changeset 471 in tmcsimulator for trunk/src/python/unifiedlogger/logging_service.py
- Timestamp:
- 07/29/2019 01:36:40 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/python/unifiedlogger/logging_service.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/python/unifiedlogger/logging_service.py
r466 r471 4 4 5 5 outputFilename = "unifiedlog.csv" 6 6 seconds = 0 7 # convert seconds to H:MM:SS 8 def toHMS(seconds): 9 m, s = divmod(int(seconds), 60) 10 h, m = divmod(m, 60) 11 return "%d:%02d:%02d" % (h, m, s) 12 7 13 # Load the sim time file and extract the seconds */ 8 14 def getSimTime(): 15 global seconds 9 16 with open ("webapps/dynamicdata/sim_elapsedtime.json", 'r') as myfile: 10 17 jsonData=myfile.read() 11 seconds = 012 18 try: 13 19 seconds = json.loads(jsonData)['elapsedtime'] 14 20 except: 15 print "Error loading json for elapsed time" 21 print "Unable to read sim time. ", 22 print "Proceeding with previous time: ", toHMS(seconds) 16 23 # convert seconds to H:MM:SS 17 m, s = divmod(int(seconds), 60) 18 h, m = divmod(m, 60) 19 return "%d:%02d:%02d" % (h, m, s) 24 return toHMS(seconds) 20 25 21 26 def startup():
Note: See TracChangeset
for help on using the changeset viewer.
