WPILibC++ 2024.3.2
Utility Functions

Functions

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

Detailed Description

Function Documentation

◆ GetStringFromType()

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

Turns a type enum value into a type string.

Parameters
typetype enum
Returns
Type string

◆ GetTypeFromString()

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

Turns a type string into a type enum value.

Parameters
typeStringtype string
Returns
Type value

◆ Now()

int64_t 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::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 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::Now() is a concern. If used, it should be called periodically with the value of wpi::Now().

Parameters
timestamptimestamp (1 us increments)