Package com.ctre.phoenix6
Class Utils
java.lang.Object
com.ctre.phoenix6.Utils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
fpgaToCurrentTime
(double fpgaTimeSeconds) Converts an FPGA timestamp to the timebase reported bygetCurrentTimeSeconds()
.static double
Get the current timestamp in seconds.static double
Get the system timestamp in seconds.static boolean
isReplay()
Get whether the program is running in replay mode.static boolean
Get whether the program is running in simulation.
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
getCurrentTimeSeconds
Get the current timestamp in seconds.This is the time source used for status signals.
This time source is typically continuous and monotonic. However, it may be overridden in simulation to use a non-monotonic, non-continuous source.
- Returns:
- Current time in seconds
-
getSystemTimeSeconds
Get the system timestamp in seconds.This is NOT the time source used for status signals. Use GetCurrentTImeSeconds instead when working with status signal timing.
This time source is guaranteed to be continuous and monotonic, making it useful for measuring time deltas in a robot program.
- Returns:
- System time in seconds
-
isSimulation
Get whether the program is running in simulation.- Returns:
true
if in simulation
-
isReplay
Get whether the program is running in replay mode.- Returns:
true
if in replay mode
-
fpgaToCurrentTime
Converts an FPGA timestamp to the timebase reported bygetCurrentTimeSeconds()
.- Parameters:
fpgaTimeSeconds
- The FPGA timestamp in seconds- Returns:
- The equivalent
getCurrentTimeSeconds()
timestamp in seconds
-