WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
Utility Functions

Functions

int64_t wpi::nt::Now ()
 Returns monotonic current time in 1 us increments.
void wpi::nt::SetNow (int64_t timestamp)
 Sets the current timestamp used for timestamping values that do not provide a timestamp (e.g.
NT_Type wpi::nt::GetTypeFromString (std::string_view typeString)
 Turns a type string into a type enum value.
std::string_view wpi::nt::GetStringFromType (NT_Type type)
 Turns a type enum value into a type string.

Detailed Description

Function Documentation

◆ GetStringFromType()

std::string_view wpi::nt::GetStringFromType ( NT_Type type)

Turns a type enum value into a type string.

Parameters
typetype enum
Returns
Type string

◆ GetTypeFromString()

NT_Type wpi::nt::GetTypeFromString ( std::string_view typeString)

Turns a type string into a type enum value.

Parameters
typeStringtype string
Returns
Type value

◆ Now()

int64_t wpi::nt::Now ( )

Returns monotonic current time in 1 us increments.

This is the same time base used for value and connection timestamps. This function by default simply wraps wpi::util::Now(), but if SetNow() is called, this function instead returns the value passed to SetNow(); this can be used to reduce overhead.

Returns
Timestamp

◆ SetNow()

void wpi::nt::SetNow ( int64_t timestamp)

Sets the current timestamp used for timestamping values that do not provide a timestamp (e.g.

a value of 0 is passed). For consistency, it also results in Now() returning the set value. This should generally be used only if the overhead of calling wpi::util::Now() is a concern. If used, it should be called periodically with the value of wpi::util::Now().

Parameters
timestamptimestamp (1 us increments)