oemware.core.util
Class TimeUtils

java.lang.Object
  extended by oemware.core.util.TimeUtils

public final class TimeUtils
extends java.lang.Object

The time utils.


Field Summary
static int RECORD_INTERVAL
           
 
Constructor Summary
TimeUtils()
           
 
Method Summary
static long convertHttpDate(java.lang.String pDate)
          Convert the passed date to milliseconds.
static int currentEpochId()
          Returns the current epoch id.
static int currentEpochTime()
          Returns the current start time (based on epoch).
static int currentTimeSecs()
          Returns the current time in seconds.
static int currentTimeSecs(long pTimeMillis)
          Returns the time in seconds for the value passed.
static int epochId(int pTime)
          Returns the time period id based on the start and stop time.
static int epochId(int pStartTime, int pStopTime)
          Returns the epoch id for the start/stop time.
static int epochTime(int pEpochId)
          Returns the time for the epoch id passed.
static long secsToMillis(int pTime)
          Returns the time in ms - converted from seconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECORD_INTERVAL

public static final int RECORD_INTERVAL
See Also:
Constant Field Values
Constructor Detail

TimeUtils

public TimeUtils()
Method Detail

epochId

public static final int epochId(int pStartTime,
                                int pStopTime)
Returns the epoch id for the start/stop time. This will take the epoch in which this spent the most time. This is a little fuzzy but it works well over time.

Parameters:
pStartTime - The start time.
pStopTime - The stop time.
Returns:
The epoch id.

currentEpochTime

public static final int currentEpochTime()
Returns the current start time (based on epoch).

Returns:
The currenht start time (based on epoch).

currentEpochId

public static final int currentEpochId()
Returns the current epoch id.

Returns:
The current epoch id.

epochTime

public static final int epochTime(int pEpochId)
Returns the time for the epoch id passed. Assumes a valid 300 second epoch.

Parameters:
pEpochId - The epoch id.
Returns:
The time.

epochId

public static final int epochId(int pTime)
Returns the time period id based on the start and stop time.

Parameters:
pTime - The time the event started (in seconds).
Returns:
The period id. The period id devides the day into five minute intervals that are unique since THE epoch. time in secs / 300 = X (epoch: January 1, 1970 00:00:00.000 GMT).

currentTimeSecs

public static final int currentTimeSecs()
Returns the current time in seconds.

Returns:
The time in seconds.

currentTimeSecs

public static final int currentTimeSecs(long pTimeMillis)
Returns the time in seconds for the value passed.

Parameters:
pTimeMillis - The millis time.
Returns:
The time in seconds.

secsToMillis

public static final long secsToMillis(int pTime)
Returns the time in ms - converted from seconds.

Parameters:
pTime - The time in seconds.
Returns:
The time in ms.

convertHttpDate

public static final long convertHttpDate(java.lang.String pDate)
Convert the passed date to milliseconds. This method creates a new date format object for each parse. This method shouldn't be used in performance critical sections.

Formats Supported:
Thu, 03 Jan 2008 14:29:00 GMT
Sunday, 06-Nov-94 08:49:37 GMT
Sun Nov 6 08:49:37 1994

Parameters:
pDate - The raw RFC 822/1123 time.
Returns:
The time or -1 if the format is invalid.


Copyright © 2009 Deft Labs - Released under LGPL, Version 3.0