public static long getSeconds(byte[] bytes, int offset) {
    int lowest31BitsOfSecondsAndFlag = bytesToInt(bytes, offset);
    if (lowest31BitsOfSecondsAndFlag >= 0 ||  // the "has decimal or second VInt" flag is not set
        !hasSecondVInt(bytes[offset + 4])) {
      // The entire seconds field is stored in the first 4 bytes.
      return lowest31BitsOfSecondsAndFlag & LOWEST_31_BITS_OF_SEC_MASK;
    }

    // We compose the seconds field from two parts. The lowest 31 bits come from the first four
    // bytes. The higher-order bits come from the second VInt that follows the nanos field.
    return ((long) (lowest31BitsOfSecondsAndFlag & LOWEST_31_BITS_OF_SEC_MASK)) |
           (LazyBinaryUtils.readVLongFromByteArray(bytes,
               offset + 4 + WritableUtils.decodeVIntSize(bytes[offset + 4])) << 31);
  }
Gets seconds stored as integer at bytes[offset]
@param bytes
@param offset
@return the number of seconds
serde/src/java/org/apache/hadoop/hive/serde2/io/TimestampWritable.java