
package tmcsim.common;

/**
 * A Utility class of methods for manipulating time values.
 */
public class TimeUtils
{
    /**
     * Converts a the long representation of the time, to the H:MM:SS String format
     *
     * @param seconds number of seconds.
     * @return String H:MM:SS time representation.
     */
    public static String longToTime(long seconds) {
        String time = new String();     
        long timeSegment;   
        
        timeSegment = seconds / 3600;
        time += String.valueOf(timeSegment) + ":";      
        
        seconds = seconds % 3600;
        
        timeSegment = seconds / 60;
        if(timeSegment < 10)
            time += "0";
        
        time += String.valueOf(timeSegment) + ":";      
        seconds = seconds % 60; 
        
        timeSegment = seconds;
        if(timeSegment < 10)
            time += "0";
        
        time += String.valueOf(timeSegment);
        
        return time;        
    }

    
}
