ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/util/uk/org/iscream/cms/util/DateUtils.java
(Generate patch)

Comparing projects/cms/source/util/uk/org/iscream/cms/util/DateUtils.java (file contents):
Revision 1.2 by tdb, Mon Feb 5 22:21:20 2001 UTC vs.
Revision 1.4 by tdb, Fri Mar 16 17:14:23 2001 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 < package uk.ac.ukc.iscream.util;
2 > package uk.org.iscream.util;
3  
4   //---IMPORTS---
5   import java.util.*;
# Line 191 | Line 191 | public class DateUtils {
191          return layout;
192      }
193      
194 +    /**
195 +     * Takes a time period in seconds and converts it to a
196 +     * reasonable message.
197 +     *
198 +     * @param time the time period in seconds
199 +     * @return a String respresentation of the given time period
200 +     */
201 +    public static String getTimeString(long time) {
202 +        String timeString = null;
203 +        if (time >= 3600) {
204 +            timeString = ((time/60) / 60) + " hour(s)";
205 +        } else if (time >= 60) {
206 +            timeString = (time / 60) + " minute(s)";
207 +        } else {
208 +            timeString = time + " second(s)";
209 +        }
210 +        return timeString;
211 +    }
212  
213   //---CONSTRUCTORS---
214  
# Line 200 | Line 218 | public class DateUtils {
218       * Overrides the {@link java.lang.Object#toString() Object.toString()}
219       * method to provide clean logging (every class should have this).
220       *
221 <     * This uses the uk.ac.ukc.iscream.util.FormatName class
221 >     * This uses the uk.org.iscream.util.FormatName class
222       * to format the toString()
223       *
224       * @return the name of this class and its CVS revision

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines