|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcgl.narada.service.time.ntptime.NtpTimestamp
public class NtpTimestamp
1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Seconds | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Seconds Fraction (0-padded) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ This class encapsulates the notion of a timestamp as in rfc2030. Logically it is the number of seconds since the beginning of the centure (in UTC time). It is represented as an 8 byte array, the first four bytes representing seconds and the next 4 bytes representing second fractions.
Constructor Summary | |
---|---|
NtpTimestamp()
This constructs a timestamp initialized with the current updated date. |
|
NtpTimestamp(int offset,
byte[] data)
This constructs a timestamp initialized with the data passed. |
Method Summary | |
---|---|
Date |
getTime()
Gets the date associated to this NtpTimestamp. |
long |
getTimeInMilliSeconds()
Gets the millisecond value of this NtpTimestamp |
byte[] |
getTimestampData()
Returns timestamp data which keeps the time information in byte array format. |
void |
setTimestamp(Date date)
Sets the NtpTimestamp with the given Date object |
void |
setTimestamp(int offset,
byte[] data)
Sets the timestamp with the given byte array and the start offset within the array. |
void |
setTimestampData(byte[] timestampData)
Initializes the data of the NtpTimestamp with the given byte array |
String |
toString()
Converts the date object to String format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NtpTimestamp()
public NtpTimestamp(int offset, byte[] data)
offset
- int - data is read starting from offset valuedata
- byte [] - byte array that contains timestamp informationMethod Detail |
---|
public Date getTime()
public long getTimeInMilliSeconds()
public void setTimestamp(Date date)
date
- Date - NtpTimestamp is initialized with this Date objectpublic void setTimestamp(int offset, byte[] data)
offset
- int - start offset within the given byte arraydata
- byte [] - contains NtpTimestamp information.public void setTimestampData(byte[] timestampData)
timestampData
- byte [] - data of NtpTimestamp is initialized with
this byte arraypublic byte[] getTimestampData()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |