Changeset 636 in tmcsimulator for branches


Ignore:
Timestamp:
03/08/2021 01:03:47 PM (5 years ago)
Author:
jdalbey
Message:

LCS default.py fix timestamp to be prefixed with 2 zeroes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/LCSv2/controllers/default.py

    r634 r636  
    22# Constants 
    33kLogfile = "samplelogfile.txt" 
    4 kSimtimefile = "sim_elapsedtime.json" 
     4kSimtimefile = "sim_elapsedtime.json"  #"../webapps/dynamicdata/sim_elapsed_time.json" 
    55hwys = ['','1','5', '22', '55', '57', '73', '74', '91', '133', '142', '241', '261', '405', '605'] 
    66hwyDirections = ['','NB', 'SB', 'NB/SB','EB','WB','EB/WB'] 
     
    192192            db(db.closures.closureid == session.statustype[4:]).update(**{fieldname:now.strftime("%H%M")}) 
    193193            # Log the update to external file 
    194             logmessage = getSimTime() + " LCS status update: " + session.username + ", " + session.statustype[4:] + ", " + session.statustype[0:4] + ", " + session.statuser + " " + "\n" 
     194            logmessage = getSimTime() + ", LCS status update: " + session.username + ", " + session.statustype[4:] + ", " + session.statustype[0:4] + ", " + session.statuser + " " + "\n" 
    195195            text_file = open(kLogfile, "a") 
    196196            text_file.write(logmessage) 
     
    216216        currentSimTime = jsontime["elapsedtime"] 
    217217        timestamp = str(datetime.timedelta(seconds = int(currentSimTime))) 
    218         return timestamp 
     218        return '0'+timestamp  # assume simtime is < 10 and prefix a zero 
    219219    except: 
    220220        # Fallback if missing file, use current time  
     
    317317        session.flash = 'New lane closure added: ' + newID + ' ' + newLognum + ': ' + selectedlanes 
    318318        # Log the new closure to external file. Username, closureID, route, dir, type of closure, type of work 
    319         logmessage = getSimTime() + " LCS new closure: " + session.username + ", " + newID + '.' + newLognum + ', ' + form.vars.route + form.vars.direction + ', ' + form.vars.closuretype + ', ' + form.vars.worktype + "\n" 
     319        logmessage = getSimTime() + ", LCS new closure: " + session.username + ", " + newID + '.' + newLognum + ', ' + form.vars.route + form.vars.direction + ', ' + form.vars.closuretype + ', ' + form.vars.worktype + "\n" 
    320320        text_file = open(kLogfile, "a") 
    321321        text_file.write(logmessage) 
Note: See TracChangeset for help on using the changeset viewer.