org.openbandy.util
Class TimestampUtil

java.lang.Object
  extended by org.openbandy.util.TimestampUtil

public class TimestampUtil
extends java.lang.Object

This class provides static helper methods to be used with timestamps and dates respectively and methods for the conversion of such.

(c) Copyright P. Bolliger 2007, ALL RIGHTS RESERVED.

Version:
1.0
Author:
Philipp Bolliger (philipp@bolliger.name)

Constructor Summary
TimestampUtil()
           
 
Method Summary
static boolean areEqualToTheSecond(long t1, long t2)
          Compare two timestamps (given in milliseconds) to the accuracy of one second.
static java.lang.String getActualFormatedDate()
          Returns a string representing the actual date and time according to the format 'yyyyMMdd HH:mm:ss'
static java.lang.String getFormatedDate(long timeMillis)
          Returns a string representing the actual date and time according to the format 'yyyyMMdd HH:mm:ss'
static long getTimestampFromNMEAFormatedString(java.lang.String nmea)
          Returns a timestamp in milliseconds since midnight, January 1, 1970 UTC corresponding to the string parameter which is formated according to NMEA-0183.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimestampUtil

public TimestampUtil()
Method Detail

areEqualToTheSecond

public static boolean areEqualToTheSecond(long t1,
                                          long t2)
Compare two timestamps (given in milliseconds) to the accuracy of one second.

Parameters:
t1 - The Time in milliseconds since midnight, January 1, 1970 UTC
t2 - The Time to compare with
Returns:
true if t1 and t2 are equal to the second

getActualFormatedDate

public static java.lang.String getActualFormatedDate()
Returns a string representing the actual date and time according to the format 'yyyyMMdd HH:mm:ss'

Returns:
Formated string

getFormatedDate

public static java.lang.String getFormatedDate(long timeMillis)
Returns a string representing the actual date and time according to the format 'yyyyMMdd HH:mm:ss'

Parameters:
timeMillis - The time in milliseconds since midnight, January 1, 1970 UTC
Returns:
Formated string

getTimestampFromNMEAFormatedString

public static long getTimestampFromNMEAFormatedString(java.lang.String nmea)
Returns a timestamp in milliseconds since midnight, January 1, 1970 UTC corresponding to the string parameter which is formated according to NMEA-0183.

Parameters:
nmea - Date formated according to NMEA-0183 (e.g. '10:22:33/22.11.06')
Returns:
Converted timestamp in milliseconds