com.latencybusters.lbm.sdm
Class LBMSDMRawTimestamp

java.lang.Object
  extended by com.latencybusters.lbm.sdm.LBMSDM
      extended by com.latencybusters.lbm.sdm.LBMSDMRaw
          extended by com.latencybusters.lbm.sdm.LBMSDMRawTimestamp
All Implemented Interfaces:
java.lang.Cloneable

public class LBMSDMRawTimestamp
extends LBMSDMRaw
implements java.lang.Cloneable

An LBMSDMRawTimestamp is a helper class to minimise the effort of formatting and parsing Timestamps. A Timestamp is the number of seconds and microseconds since Unix epoch


Field Summary
static int length
          The number of bytes needed to store a raw LBMSDMRawTimestamp
 
Fields inherited from class com.latencybusters.lbm.sdm.LBMSDM
DEBUG_BASIC, debug_level, DEBUG_VERBOSE_PARSING
 
Constructor Summary
LBMSDMRawTimestamp()
          Create a raw timestamp field, defaulting to 0
LBMSDMRawTimestamp(long s, long m)
          Set a raw timestamp field providing the seconds and microseconds since UNIX epoch
LBMSDMRawTimestamp(java.lang.String s)
          Set a raw timestamp field providing a string formatted timestamp
 
Method Summary
 LBMSDMRawTimestamp clone()
          Get a copy of this object
 int format(byte[] buf, int offset)
          Format the raw timestamp value into a byte buffer
 long get_sec()
          Get the number of seconds since epoch
 long get_usec()
          Get the number of microseconds since the start of the current second
 int parse(byte[] buf, int offset)
          Parse the raw timestamp value from a byte buffer
 void set(long s, long m)
          Set a uint32 field providing the value as a long
 java.lang.String toString()
          Get a string version of a timestamp
 
Methods inherited from class com.latencybusters.lbm.sdm.LBMSDMRaw
toDbgString
 
Methods inherited from class com.latencybusters.lbm.sdm.LBMSDM
log, set_debug_level
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

length

public static int length
The number of bytes needed to store a raw LBMSDMRawTimestamp

Constructor Detail

LBMSDMRawTimestamp

public LBMSDMRawTimestamp()
                   throws LBMSDMException
Create a raw timestamp field, defaulting to 0

Throws:
LBMSDMException

LBMSDMRawTimestamp

public LBMSDMRawTimestamp(long s,
                          long m)
                   throws LBMSDMException
Set a raw timestamp field providing the seconds and microseconds since UNIX epoch

Parameters:
s - The number of seconds since epoch
m - The number of microseconds since epoch
Throws:
LBMSDMUnsignedException - if an unsigned value is passed in
LBMSDMException

LBMSDMRawTimestamp

public LBMSDMRawTimestamp(java.lang.String s)
                   throws LBMSDMException
Set a raw timestamp field providing a string formatted timestamp

Parameters:
s - The string containing the time ("sec.micro" or "now")
Throws:
LBMSDMUnsignedException - if an unsigned value is passed in
LBMSDMException
Method Detail

set

public void set(long s,
                long m)
         throws LBMSDMException
Set a uint32 field providing the value as a long

Parameters:
s - The number of seconds since epoch
m - The number of microseconds since epoch
Throws:
LBMSDMUnsignedException - if an unsigned value is passed in
LBMSDMException

get_sec

public long get_sec()
             throws LBMSDMException
Get the number of seconds since epoch

Returns:
The number of seconds since epoch
Throws:
LBMSDMException

get_usec

public long get_usec()
              throws LBMSDMException
Get the number of microseconds since the start of the current second

Returns:
The number of seconds since the start of the current second
Throws:
LBMSDMException

toString

public java.lang.String toString()
Get a string version of a timestamp

Overrides:
toString in class java.lang.Object
Returns:
A string representation of the timestamp in the format, "seconds.microseconds", which is not a floating point representation of the time.

format

public int format(byte[] buf,
                  int offset)
           throws LBMSDMException
Format the raw timestamp value into a byte buffer

Parameters:
buf - The buffer to contain the formatted value
offset - The offset in to the buffer to start formatting
Returns:
The offset after formatting this object
Throws:
LBMSDMException

parse

public int parse(byte[] buf,
                 int offset)
          throws LBMSDMException
Parse the raw timestamp value from a byte buffer

Parameters:
buf - The buffer that contains the formatted value
offset - The offset in to the buffer to start parsing
Returns:
the new offset after parsing the field
Throws:
LBMSDMException

clone

public LBMSDMRawTimestamp clone()
                         throws java.lang.CloneNotSupportedException
Get a copy of this object

Overrides:
clone in class java.lang.Object
Returns:
A copy of the uint64
Throws:
java.lang.CloneNotSupportedException


All of the documentation and software included in this and any other Informatica Inc "Ultra Messaging" Release is Copyright (C) 2004-2014, Informatica Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted only as covered by the terms of a valid software license agreement with 29West Inc. Copyright © 2004-2014, Informatica, Inc. All Rights Reserved.