java.lang.Object
net.i2p.router.transport.ntcp.NTCP2Payload.Block
net.i2p.router.transport.ntcp.NTCP2Payload.DateTimeBlock
Enclosing class:
NTCP2Payload

public static class NTCP2Payload.DateTimeBlockextends NTCP2Payload.Block
Block containing the current date and time. Used for time synchronization in NTCP2 protocol.
  • Field Details

    • now

      private final long now
      The date and time sent in the payload.
  • Constructor Details

    • DateTimeBlock

      public DateTimeBlock(I2PAppContext ctx)
      Captures the current clock time for the timestamp the block carries.
      Parameters:
      ctx - clock source for the timestamp the block carries
  • Method Details

    • getDataLength

      public int getDataLength()
      The data length of this block.
      Specified by:
      getDataLength in class NTCP2Payload.Block
      Returns:
      the data length
    • writeData

      public int writeData(byte[] tgt, int off)
      Write the block data to the target array.
      Specified by:
      writeData in class NTCP2Payload.Block
      Parameters:
      tgt - the destination array
      off - index in tgt to write the data at, past the 3-byte header
      Returns:
      the offset just past the written data