|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ITimestamp
A control system time stamp.
Java already supports many time-stamp related operations via the
Calendar
class down to milliseconds, but control system time
stamps often include micro or nanosecond detail.
This time stamp uses 'seconds' with the same epoch as Calendar (1 January 1970 0:00 UTC), and adds nanosecond detail.
In addition, it supports comparisons as well as string conversions to
the form yyyy/mm/dd HH:MM:SS.MMM
, for example
2007/01/15 14:45:56.123
,
which sorts well and is disambiguated from regional preferences like
AM/PM formats, or day/month/year vs. month/day/year.
Calendar
,
TimestampFactory
Nested Class Summary | |
---|---|
static class |
ITimestamp.Format
Format specifier. |
Method Summary | |
---|---|
java.lang.String |
format(ITimestamp.Format format)
Format time according to the FMT_... |
boolean |
isGreaterOrEqual(ITimestamp other)
|
boolean |
isGreaterThan(ITimestamp other)
|
boolean |
isLessOrEqual(ITimestamp other)
|
boolean |
isLessThan(ITimestamp other)
|
boolean |
isValid()
|
long |
nanoseconds()
Nanoseconds within seconds. |
long |
seconds()
Get seconds since epoch, i.e. |
java.util.Calendar |
toCalendar()
Convert to Calendar. |
double |
toDouble()
Convert to double. |
java.sql.Timestamp |
toSQLTimestamp()
Convert to SQL Timestamp. |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Method Detail |
---|
long seconds()
Note that we always return seconds relative to this UTC epoch, even if the original control system data source might use a different epoch (example: EPICS uses 1990), because the 1970 epoch is most compatible with existing programming environments.
long nanoseconds()
seconds()
boolean isValid()
true
if seconds and
nanoseconds are > 0.double toDouble()
java.util.Calendar toCalendar()
java.sql.Timestamp toSQLTimestamp()
java.lang.String format(ITimestamp.Format format)
how
- One of the FMT_... flags.
boolean isGreaterThan(ITimestamp other)
other
- Other time stamp
true
if this time stamp is greater than
the other
time stamp.boolean isGreaterOrEqual(ITimestamp other)
other
- Other time stamp
true
if this time stamp is greater than or
equal to the other
time stamp.boolean isLessThan(ITimestamp other)
other
- Other time stamp
true
if this time stamp is smaller than
the other
time stamp.boolean isLessOrEqual(ITimestamp other)
other
- Other time stamp
true
if this time stamp is smaller than or
equal to the other
time stamp.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |