- All Implemented Interfaces:
Serializable
,Comparable<PcapTStampPrecision>
,Constable
,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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionuse timestamps with microsecond precision, default.use timestamps with nanosecond precision. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
use timestamps with microsecond precision, default.static final int
use timestamps with nanosecond precision. -
Method Summary
Modifier and TypeMethodDescriptionint
getAsInt()
Gets the as int.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 javaDate
class.long
toEpochSecond
(long epochTime) Computes number of seconds in epoch time by dropping the fractional part.long
toEpochTime
(long epochSeconds, long fractionOfSecond) To epoch time with this precision from supplied second and fraction components, as read fro pcap header.long
toFractionOfSecond
(long epochTime) Computes a fraction of a second from epoch time provided.static PcapTStampPrecision
valueOf
(int value) Value of.static PcapTStampPrecision
Returns the enum constant of this class with the specified name.static PcapTStampPrecision[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TSTAMP_PRECISION_MICRO
use timestamps with microsecond precision, default. -
TSTAMP_PRECISION_NANO
use timestamps with nanosecond precision.
-
-
Field Details
-
PCAP_TSTAMP_PRECISION_MICRO
public static final int PCAP_TSTAMP_PRECISION_MICROuse timestamps with microsecond precision, default.- See Also:
-
PCAP_TSTAMP_PRECISION_NANO
public static final int PCAP_TSTAMP_PRECISION_NANOuse timestamps with nanosecond precision.- See Also:
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
valueOf
Value of.- Parameters:
value
- the value- Returns:
- the pcap T stamp precision
-
getAsInt
public int getAsInt()Gets the as int.- Specified by:
getAsInt
in interfaceIntSupplier
- 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 javaDate
class.- Parameters:
epochSeconds
- the epoch secondsfractionOfSecond
- 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 secondsfractionOfSecond
- 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
-