ehcache

net.sf.ehcache.util
Class TimeUtil

java.lang.Object
  extended by net.sf.ehcache.util.TimeUtil

public class TimeUtil
extends Object

Utilities for converting times

Author:
Greg Luck

Constructor Summary
TimeUtil()
           
 
Method Summary
static int convertTimeToInt(long seconds)
          Converts a long seconds value to an int seconds value and takes into account overflow from the downcast by switching to Integer.MAX_VALUE.
static long toMillis(int timeInSecs)
          Converts seconds to milliseconds, with a precision of 1 second
static int toSecs(long timeInMillis)
          Converts milliseconds to seconds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeUtil

public TimeUtil()
Method Detail

toSecs

public static int toSecs(long timeInMillis)
Converts milliseconds to seconds

Parameters:
timeInMillis -
Returns:
The equivalent time in seconds

toMillis

public static long toMillis(int timeInSecs)
Converts seconds to milliseconds, with a precision of 1 second

Parameters:
timeInSecs - the time in seconds
Returns:
The equivalent time in milliseconds

convertTimeToInt

public static int convertTimeToInt(long seconds)
Converts a long seconds value to an int seconds value and takes into account overflow from the downcast by switching to Integer.MAX_VALUE.

Parameters:
seconds - Long value
Returns:
Same int value unless long > Integer.MAX_VALUE in which case MAX_VALUE is returned

ehcache

Copyright 2001-2014, Terracotta, Inc.