Package org.yamcs.time
Interface TimeEncoder
- All Known Implementing Classes:
CucTimeEncoder
public interface TimeEncoder
Interface for time encoders used in the
PacketPreprocessor
-
Method Details
-
encode
int encode(long instant, byte[] buf, int offset) Encodes the Yamcs instant into the binary buffer.It is assumed that the buffer will have enough space; if not, an
ArrayIndexOutOfBoundsException
will be thrown.- Parameters:
instant
- - time in milliseconds to be encodedbuf
- - where to write the encoded timeoffset
- - offset in the buffer where the encoding will begin- Returns:
- the number of bytes encoded
-
encodeRaw
int encodeRaw(long time, byte[] buf, int offset) Encodes the time in an unspecified unit.This can be used when the on-board time is free running.
It is assumed that the buffer will have enough space; if not, an
ArrayIndexOutOfBoundsException
will be thrown.- Parameters:
time
- - time in unspecified units to be encodedbuf
- - where to write the encoded timeoffset
- - offset in the buffer where the encoding will begin- Returns:
- the number of bytes encoded
-
getEncodedLength
int getEncodedLength()Returns the size in bytes of the encoded time.If the size is variable return -1
-