Code example for Timestamp

Methods: getNanos, getTime

0
  public static void convertTimestampToBytes(Timestamp t, byte[] b,
      int offset) {
    if (b.length < 9) {
      LOG.error("byte array too short");
    } 
    long millis = t.getTime();
    int nanos = t.getNanos();
 
    boolean hasDecimal = setNanosBytes(nanos, b, offset+4);
    setSecondsBytes(millis, b, offset, hasDecimal);
  } 
 
  /** 
   * Given an integer representing seconds, write its serialized 
   * value to the byte array b at offset 
   * @param millis 
   * @param b 
   * @param offset 
   * @param hasDecimal 
   */ 
  private static void setSecondsBytes(long millis, byte[] b, int offset, boolean hasDecimal) {