1 |
+ |
/* |
2 |
+ |
* i-scream central monitoring system |
3 |
+ |
* Copyright (C) 2000-2002 i-scream |
4 |
+ |
* |
5 |
+ |
* This program is free software; you can redistribute it and/or |
6 |
+ |
* modify it under the terms of the GNU General Public License |
7 |
+ |
* as published by the Free Software Foundation; either version 2 |
8 |
+ |
* of the License, or (at your option) any later version. |
9 |
+ |
* |
10 |
+ |
* This program is distributed in the hope that it will be useful, |
11 |
+ |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
+ |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
+ |
* GNU General Public License for more details. |
14 |
+ |
* |
15 |
+ |
* You should have received a copy of the GNU General Public License |
16 |
+ |
* along with this program; if not, write to the Free Software |
17 |
+ |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 |
+ |
*/ |
19 |
+ |
|
20 |
|
//---PACKAGE DECLARATION--- |
21 |
< |
package uk.org.iscream.util; |
21 |
> |
package uk.org.iscream.cms.server.util; |
22 |
|
|
23 |
|
//---IMPORTS--- |
24 |
|
import java.util.*; |
210 |
|
return layout; |
211 |
|
} |
212 |
|
|
213 |
+ |
/** |
214 |
+ |
* Takes a time period in seconds and converts it to a |
215 |
+ |
* reasonable message. |
216 |
+ |
* |
217 |
+ |
* @param time the time period in seconds |
218 |
+ |
* @return a String respresentation of the given time period |
219 |
+ |
*/ |
220 |
+ |
public static String getTimeString(long time) { |
221 |
+ |
String timeString = null; |
222 |
+ |
if (time >= 3600) { |
223 |
+ |
timeString = ((time/60) / 60) + " hour(s)"; |
224 |
+ |
} else if (time >= 60) { |
225 |
+ |
timeString = (time / 60) + " minute(s)"; |
226 |
+ |
} else { |
227 |
+ |
timeString = time + " second(s)"; |
228 |
+ |
} |
229 |
+ |
return timeString; |
230 |
+ |
} |
231 |
|
|
232 |
|
//---CONSTRUCTORS--- |
233 |
|
|
237 |
|
* Overrides the {@link java.lang.Object#toString() Object.toString()} |
238 |
|
* method to provide clean logging (every class should have this). |
239 |
|
* |
240 |
< |
* This uses the uk.org.iscream.util.FormatName class |
240 |
> |
* This uses the uk.org.iscream.cms.server.util.FormatName class |
241 |
|
* to format the toString() |
242 |
|
* |
243 |
|
* @return the name of this class and its CVS revision |