Ignore:
Timestamp:
03/27/2019 03:01:27 PM (7 years ago)
Author:
jdalbey
Message:

tmcsim.common package: Added class TimeUtils?.java and moved longtotime() into it from SimulationManagerView?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/tmcsim/simulationmanager/SimulationManagerView.java

    r47 r349  
    4141import tmcsim.common.CADEnums.PARAMICS_STATUS; 
    4242import tmcsim.common.CADEnums.SCRIPT_STATUS; 
     43import tmcsim.common.TimeUtils; 
    4344import tmcsim.simulationmanager.actions.AddIncidentAction; 
    4445import tmcsim.simulationmanager.actions.ApplyDiversionAction; 
     
    329330        currentSimulationTime = time; 
    330331         
    331         String newTime = longToTime(currentSimulationTime); 
     332        String newTime = TimeUtils.longToTime(currentSimulationTime); 
    332333         
    333334        simulationClockLabel.setText(newTime); 
     
    631632    } 
    632633     
    633     /** 
    634      * Converts a the long representation of the time, to the H:MM:SS String format 
    635      * 
    636      * @param seconds number of seconds. 
    637      * @return String H:MM:SS time representation. 
    638      */ 
    639     public static String longToTime(long seconds) { 
    640         String time = new String();      
    641         long timeSegment;    
    642          
    643         timeSegment = seconds / 3600; 
    644         time += String.valueOf(timeSegment) + ":";       
    645          
    646         seconds = seconds % 3600; 
    647          
    648         timeSegment = seconds / 60; 
    649         if(timeSegment < 10) 
    650             time += "0"; 
    651          
    652         time += String.valueOf(timeSegment) + ":";       
    653         seconds = seconds % 60;  
    654          
    655         timeSegment = seconds; 
    656         if(timeSegment < 10) 
    657             time += "0"; 
    658          
    659         time += String.valueOf(timeSegment); 
    660          
    661         return time;         
    662     } 
    663  
    664634    /** 
    665635     * This method is used to disply a message dialog with the received  
Note: See TracChangeset for help on using the changeset viewer.