:py:mod:`phoenix6.utils` ======================== .. py:module:: phoenix6.utils Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: phoenix6.utils.get_current_time_seconds phoenix6.utils.get_system_time_seconds phoenix6.utils.is_simulation phoenix6.utils.is_replay phoenix6.utils.fpga_to_current_time phoenix6.utils.current_time_to_fpga_time Attributes ~~~~~~~~~~ .. autoapisummary:: phoenix6.utils.USE_WPILIB .. py:data:: USE_WPILIB :value: 'True' .. py:function:: get_current_time_seconds() -> phoenix6.units.second 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 :rtype: second .. py:function:: get_system_time_seconds() -> phoenix6.units.second 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 :rtype: second .. py:function:: is_simulation() -> bool Get whether the program is running in simulation. :returns: True if in simulation :rtype: bool .. py:function:: is_replay() -> bool Get whether the program is running in replay mode. :returns: True if in replay mode :rtype: bool .. py:function:: fpga_to_current_time(fpga_time: phoenix6.units.second) -> phoenix6.units.second Converts an FPGA timestamp to the timebase reported by get_current_time_seconds(). :param fpga_time: The FPGA timestamp :type fpga_time: second :returns: The equivalent get_current_time_seconds() timestamp :rtype: second .. py:function:: current_time_to_fpga_time(current_time: phoenix6.units.second) -> phoenix6.units.second Converts a timestamp in the timebase reported by get_current_time_seconds() to an FPGA timestamp. :param current_time: The timestamp reported by get_current_time_seconds() :type fpga_time: second :returns: The equivalent FPGA timestamp :rtype: second