org.csstudio.data.values
Class TimestampFactory

java.lang.Object
  extended by org.csstudio.data.values.TimestampFactory

public final class TimestampFactory
extends java.lang.Object

A factory for ITimestamp time stamps.

Author:
Sven Wende, Kay Kasemir

Method Summary
static ITimestamp createTimestamp(long seconds, long nanoseconds)
          Creates a time stamp based on the specified seconds and nanoseconds.
static ITimestamp fromCalendar(java.util.Calendar calendar)
          Create a time stamp for the given Calendar.
static ITimestamp fromDouble(double seconds)
          Creates a time stamp based on the specified seconds.
static ITimestamp fromMillisecs(long millisecs)
          Create a time stamp for the given milliseconds since the epoch.
static ITimestamp fromSQLTimestamp(java.sql.Timestamp sql_time)
          Convert SQL Timestamp into CSS Timestamp.
static ITimestamp now()
          Creates a time stamp for the current system time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createTimestamp

public static ITimestamp createTimestamp(long seconds,
                                         long nanoseconds)
Creates a time stamp based on the specified seconds and nanoseconds.

Refer to ITimestamp for details on epoch etc.

The nanoseconds will get normalized, i.e. it's OK to provide nanoseconds that amount to seconds.

Parameters:
seconds - Seconds since 1970 epoch
nanoseconds - Nanoseconds within the seconds
Returns:
New time stamp

now

public static ITimestamp now()
Creates a time stamp for the current system time.

Returns:
Time stamp set to the current system time

fromDouble

public static ITimestamp fromDouble(double seconds)
Creates a time stamp based on the specified seconds.

Refer to ITimestamp for details on epoch etc.

Parameters:
seconds - Seconds since 1970 epoch
Returns:
New time stamp

fromCalendar

public static ITimestamp fromCalendar(java.util.Calendar calendar)
Create a time stamp for the given Calendar.

Parameters:
calendar - Calendar value to convert into time stamp
Returns:
Time stamp set to given Calendar value.

fromMillisecs

public static ITimestamp fromMillisecs(long millisecs)
Create a time stamp for the given milliseconds since the epoch.

Parameters:
millisecs - Milliseconds since 1970 epoch
Returns:
Time stamp set to given milliseconds.

fromSQLTimestamp

public static ITimestamp fromSQLTimestamp(java.sql.Timestamp sql_time)
Convert SQL Timestamp into CSS Timestamp.

Parameters:
time - SQL Timestamp
Returns:
CSS ITimestamp