Ignore:
Timestamp:
08/24/07 22:05:08 (5 years ago)
Author:
saua
Message:

Implement details screen (issue #18)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bbtracker_common/trunk/src/org/bbtracker/Utils.java

    r61 r93  
    242242                return result.toString(); 
    243243        } 
     244 
     245        public static String durationToString(final long msec) { 
     246                // i do hope no one uses bbTracker do record tracks that 
     247                // are longer than Integer.MAX_VALUE seconds. 
     248                final StringBuffer sb = new StringBuffer(8); 
     249                int sec = (int) (msec / 1000); 
     250                if (sec > 60 * 60) { 
     251                        final int hours = sec / (60 * 60); 
     252                        sb.append(hours); 
     253                        sec -= hours * (60 * 60); 
     254                        sb.append(':'); 
     255                } 
     256 
     257                final int minutes = sec / 60; 
     258                if (sb.length() > 0) { 
     259                        appendTwoDigits(sb, minutes, '0'); 
     260                } else { 
     261                        sb.append(minutes); 
     262                } 
     263                sb.append(':'); 
     264 
     265                appendTwoDigits(sb, sec, '0'); 
     266 
     267                return sb.toString(); 
     268        } 
    244269} 
Note: See TracChangeset for help on using the changeset viewer.