Module org.jnetpcap

Enum Class PcapTStampPrecision

java.lang.Object
java.lang.Enum<PcapTStampPrecision>
org.jnetpcap.constant.PcapTStampPrecision
All Implemented Interfaces:
Serializable, Comparable<PcapTStampPrecision>, Constable, IntSupplier

public enum PcapTStampPrecision extends Enum<PcapTStampPrecision> implements IntSupplier
Time stamp resolution types. Not all systems and interfaces will necessarily support all of these resolutions when doing live captures; all of them can be requested when reading a savefile.
 
#define PCAP_TSTAMP_PRECISION_MICRO     0       // use timestamps with microsecond precision, default
#define PCAP_TSTAMP_PRECISION_NANO      1       // use timestamps with nanosecond precision
 
 
Author:
mark
  • Enum Constant Details

    • TSTAMP_PRECISION_MICRO

      public static final PcapTStampPrecision TSTAMP_PRECISION_MICRO
      use timestamps with microsecond precision, default.
    • TSTAMP_PRECISION_NANO

      public static final PcapTStampPrecision TSTAMP_PRECISION_NANO
      use timestamps with nanosecond precision.
  • Field Details

    • PCAP_TSTAMP_PRECISION_MICRO

      public static final int PCAP_TSTAMP_PRECISION_MICRO
      use timestamps with microsecond precision, default.
      See Also:
    • PCAP_TSTAMP_PRECISION_NANO

      public static final int PCAP_TSTAMP_PRECISION_NANO
      use timestamps with nanosecond precision.
      See Also:
  • Method Details

    • values

      public static PcapTStampPrecision[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static PcapTStampPrecision valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • valueOf

      public static PcapTStampPrecision valueOf(int value)
      Value of.
      Parameters:
      value - the value
      Returns:
      the pcap T stamp precision
    • getAsInt

      public int getAsInt()
      Gets the as int.
      Specified by:
      getAsInt in interface IntSupplier
      Returns:
      the as int
      See Also:
    • toEpochMilli

      public long toEpochMilli(long epochSeconds, long fractionOfSecond)
      Converts second and fraction components, as read from pcap header, to milli seconds in epoch time suitable for use with java Date class.
      Parameters:
      epochSeconds - the epoch seconds
      fractionOfSecond - the fraction of second
      Returns:
      number of millis since start of epoch time
    • toEpochSecond

      public long toEpochSecond(long epochTime)
      Computes number of seconds in epoch time by dropping the fractional part.
      Parameters:
      epochTime - in this fractional precision, ie. nanos or micros since start of epoch Jan 1st, 1970 12:00am
      Returns:
      number of seconds in epoch time
    • toEpochTime

      public long toEpochTime(long epochSeconds, long fractionOfSecond)
      To epoch time with this precision from supplied second and fraction components, as read fro pcap header.
      Parameters:
      epochSeconds - the epoch seconds
      fractionOfSecond - the fraction of second in this time unit
      Returns:
      number of fractional units, in this precision, since start of epoch, Jan 1st, 1970 12:00am
    • toFractionOfSecond

      public long toFractionOfSecond(long epochTime)
      Computes a fraction of a second from epoch time provided.
      Parameters:
      epochTime - the epoch time
      Returns:
      fraction of a second in this precision