[style] clean up of recent changes to time.h/c
This commit is contained in:
		
							parent
							
								
									135836e1de
								
							
						
					
					
						commit
						b2acdd126d
					
				
					 2 changed files with 298 additions and 255 deletions
				
			
		| 
						 | 
				
			
			@ -24,15 +24,14 @@ extern "C"
 | 
			
		|||
#include "rcl/types.h"
 | 
			
		||||
#include "rcl/visibility_control.h"
 | 
			
		||||
 | 
			
		||||
#define RCL_S_TO_NS(seconds) (seconds * 1000 * 1000 * 1000)
 | 
			
		||||
#define RCL_MS_TO_NS(milliseconds) (milliseconds * 1000 * 1000)
 | 
			
		||||
#define RCL_S_TO_NS(seconds) (seconds * (1000 * 1000 * 1000))
 | 
			
		||||
#define RCL_MS_TO_NS(milliseconds) (milliseconds * (1000 * 1000))
 | 
			
		||||
#define RCL_US_TO_NS(microseconds) (microseconds * 1000)
 | 
			
		||||
 | 
			
		||||
#define RCL_NS_TO_S(nanoseconds) (nanoseconds / (1000 * 1000 * 1000))
 | 
			
		||||
#define RCL_NS_TO_MS(nanoseconds) (nanoseconds / (1000 * 1000))
 | 
			
		||||
#define RCL_NS_TO_US(nanoseconds) (nanoseconds / 1000)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
enum rcl_time_source_type_t
 | 
			
		||||
{
 | 
			
		||||
  RCL_TIME_SOURCE_UNINITIALIZED = 0,
 | 
			
		||||
| 
						 | 
				
			
			@ -77,324 +76,344 @@ typedef struct rcl_duration_t
 | 
			
		|||
 | 
			
		||||
/// Check if the time_source has valid values.
 | 
			
		||||
/* This function returns true if the time source appears to be valid.
 | 
			
		||||
* It will check that the type is not uninitialized, and that pointers
 | 
			
		||||
* are not invalid. Note that if data is uninitialized it may give a
 | 
			
		||||
* false positive.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] time_source the handle to the time_source which is being queried
 | 
			
		||||
* \return true if the source is believed to be valid, otherwise return false.
 | 
			
		||||
*/
 | 
			
		||||
 * It will check that the type is not uninitialized, and that pointers
 | 
			
		||||
 * are not invalid.
 | 
			
		||||
 * Note that if data is uninitialized it may give a false positive.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_source the handle to the time_source which is being queried
 | 
			
		||||
 * \return true if the source is believed to be valid, otherwise return false.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
bool rcl_time_source_valid(rcl_time_source_t * time_source);
 | 
			
		||||
bool
 | 
			
		||||
rcl_time_source_valid(rcl_time_source_t * time_source);
 | 
			
		||||
 | 
			
		||||
/// Initialize a timesource as a RCL_ROS_TIME time source.
 | 
			
		||||
/* This will allocate all necessary internal structures, and initialize variables.
 | 
			
		||||
* It is specifically setting up a RCL_ROS_TIME time source.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] time_source the handle to the time_source which is being initialized
 | 
			
		||||
* \return RCL_RET_OK if the time source was successfully initialized, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 * It is specifically setting up a RCL_ROS_TIME time source.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_source the handle to the time_source which is being initialized
 | 
			
		||||
 * \return RCL_RET_OK if the time source was successfully initialized, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_init_ros_time_source(rcl_time_source_t * time_source);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_init_ros_time_source(rcl_time_source_t * time_source);
 | 
			
		||||
 | 
			
		||||
/// Finalize a timesource as a RCL_ROS_TIME time source.
 | 
			
		||||
/* This will deallocate all necessary internal structures, and clean up any variables.
 | 
			
		||||
* It is specifically setting up a RCL_ROS_TIME time source. It is expected to be paired with
 | 
			
		||||
* the init fuction.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] time_source the handle to the time_source which is being initialized
 | 
			
		||||
* \return RCL_RET_OK if the time source was successfully finalized, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 * It is specifically setting up a RCL_ROS_TIME time source. It is expected to be paired with
 | 
			
		||||
 * the init fuction.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_source the handle to the time_source which is being initialized
 | 
			
		||||
 * \return RCL_RET_OK if the time source was successfully finalized, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_fini_ros_time_source(rcl_time_source_t * time_source);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_fini_ros_time_source(rcl_time_source_t * time_source);
 | 
			
		||||
 | 
			
		||||
/// Initialize a timesource as a RCL_STEADY_TIME time source.
 | 
			
		||||
/* This will allocate all necessary internal structures, and initialize variables.
 | 
			
		||||
* It is specifically setting up a RCL_STEADY_TIME time source.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] time_source the handle to the time_source which is being initialized
 | 
			
		||||
* \return RCL_RET_OK if the time source was successfully initialized, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 * It is specifically setting up a RCL_STEADY_TIME time source.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_source the handle to the time_source which is being initialized
 | 
			
		||||
 * \return RCL_RET_OK if the time source was successfully initialized, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_init_steady_time_source(rcl_time_source_t * time_source);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_init_steady_time_source(rcl_time_source_t * time_source);
 | 
			
		||||
 | 
			
		||||
/// Finalize a timesource as a RCL_STEADY_TIME time source.
 | 
			
		||||
/* Finalize the timesource as a RCL_STEADY_TIME time source.
 | 
			
		||||
*
 | 
			
		||||
* This will deallocate all necessary internal structures, and clean up any variables.
 | 
			
		||||
* It is specifically setting up a steady time source. It is expected to be paired with
 | 
			
		||||
* the init fuction.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] time_source the handle to the time_source which is being initialized
 | 
			
		||||
* \return RCL_RET_OK if the time source was successfully finalized, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 *
 | 
			
		||||
 * This will deallocate all necessary internal structures, and clean up any variables.
 | 
			
		||||
 * It is specifically setting up a steady time source. It is expected to be paired with
 | 
			
		||||
 * the init fuction.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_source the handle to the time_source which is being initialized
 | 
			
		||||
 * \return RCL_RET_OK if the time source was successfully finalized, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_fini_steady_time_source(rcl_time_source_t * time_source);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_fini_steady_time_source(rcl_time_source_t * time_source);
 | 
			
		||||
 | 
			
		||||
/// Initialize a timesource as a RCL_SYSTEM_TIME time source.
 | 
			
		||||
/* Initialize the timesource as a RCL_SYSTEM_TIME time source.
 | 
			
		||||
*
 | 
			
		||||
* This will allocate all necessary internal structures, and initialize variables.
 | 
			
		||||
* It is specifically setting up a system time source.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] time_source the handle to the time_source which is being initialized
 | 
			
		||||
* \return RCL_RET_OK if the time source was successfully initialized, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 *
 | 
			
		||||
 * This will allocate all necessary internal structures, and initialize variables.
 | 
			
		||||
 * It is specifically setting up a system time source.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_source the handle to the time_source which is being initialized
 | 
			
		||||
 * \return RCL_RET_OK if the time source was successfully initialized, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_init_system_time_source(rcl_time_source_t * time_source);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_init_system_time_source(rcl_time_source_t * time_source);
 | 
			
		||||
 | 
			
		||||
/// Finalize a timesource as a RCL_SYSTEM_TIME time source.
 | 
			
		||||
/* Finalize the timesource as a RCL_SYSTEM_TIME time source.
 | 
			
		||||
*
 | 
			
		||||
* This will deallocate all necessary internal structures, and clean up any variables.
 | 
			
		||||
* It is specifically setting up a system time source. It is expected to be paired with
 | 
			
		||||
* the init fuction.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] time_source the handle to the time_source which is being initialized.
 | 
			
		||||
* \return RCL_RET_OK if the time source was successfully finalized, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 *
 | 
			
		||||
 * This will deallocate all necessary internal structures, and clean up any variables.
 | 
			
		||||
 * It is specifically setting up a system time source. It is expected to be paired with
 | 
			
		||||
 * the init fuction.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_source the handle to the time_source which is being initialized.
 | 
			
		||||
 * \return RCL_RET_OK if the time source was successfully finalized, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_fini_system_time_source(rcl_time_source_t * time_source);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_fini_system_time_source(rcl_time_source_t * time_source);
 | 
			
		||||
 | 
			
		||||
/// Initialize a time point using the time_source.
 | 
			
		||||
/* This function will initialize the time_point using the time_source
 | 
			
		||||
* as a reference.
 | 
			
		||||
* If the time_source is null it will use the system default time_source.
 | 
			
		||||
*
 | 
			
		||||
* This will allocate all necessary internal structures, and initialize variables.
 | 
			
		||||
* The time_source may be of types RCL_ROS_TIME, RCL_STEADY_TIME, or RCL_SYSTEM_TIME.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] time_point the handle to the time_source which is being initialized.
 | 
			
		||||
* \param[in] time_source the handle to the time_source will be used for reference.
 | 
			
		||||
* \return RCL_RET_OK if the last call time was retrieved successfully, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 * as a reference.
 | 
			
		||||
 * If the time_source is null it will use the system default time_source.
 | 
			
		||||
 *
 | 
			
		||||
 * This will allocate all necessary internal structures, and initialize variables.
 | 
			
		||||
 * The time_source may be of types RCL_ROS_TIME, RCL_STEADY_TIME, or RCL_SYSTEM_TIME.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_point the handle to the time_source which is being initialized.
 | 
			
		||||
 * \param[in] time_source the handle to the time_source will be used for reference.
 | 
			
		||||
 * \return RCL_RET_OK if the last call time was retrieved successfully, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_init_time_point(rcl_time_point_t * time_point, rcl_time_source_t * time_source);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_init_time_point(rcl_time_point_t * time_point, rcl_time_source_t * time_source);
 | 
			
		||||
 | 
			
		||||
/// Finalize a time_point
 | 
			
		||||
/* Finalize the time_point such that it is ready for deallocation.
 | 
			
		||||
*
 | 
			
		||||
* This will deallocate all necessary internal structures, and clean up any variables.
 | 
			
		||||
* *
 | 
			
		||||
* \param[in] time_point the handle to the time_source which is being finalized.
 | 
			
		||||
* \return RCL_RET_OK if the last call time was retrieved successfully, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 *
 | 
			
		||||
 * This will deallocate all necessary internal structures, and clean up any variables.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_point the handle to the time_source which is being finalized.
 | 
			
		||||
 * \return RCL_RET_OK if the last call time was retrieved successfully, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_fini_time_point(rcl_time_point_t * time_point);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_fini_time_point(rcl_time_point_t * time_point);
 | 
			
		||||
 | 
			
		||||
/// Initialize a duration using the time_source.
 | 
			
		||||
/* This function will initialize the duration using the time_source
 | 
			
		||||
* as a reference.
 | 
			
		||||
* If the time_source is null it will use the system default time_source.
 | 
			
		||||
*
 | 
			
		||||
* This will allocate all necessary internal structures, and initialize variables.
 | 
			
		||||
* The time_source may be of types ros, steady, or system.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] duration the handle to the duration which is being initialized.
 | 
			
		||||
* \param[in] time_source the handle to the time_source will be used for reference.
 | 
			
		||||
* \return RCL_RET_OK if the last call time was retrieved successfully, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
/* This function will initialize the duration using the time_source as a reference.
 | 
			
		||||
 * If the time_source is null it will use the system default time_source.
 | 
			
		||||
 *
 | 
			
		||||
 * This will allocate all necessary internal structures, and initialize variables.
 | 
			
		||||
 * The time_source may be of types ros, steady, or system.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] duration the handle to the duration which is being initialized.
 | 
			
		||||
 * \param[in] time_source the handle to the time_source will be used for reference.
 | 
			
		||||
 * \return RCL_RET_OK if the last call time was retrieved successfully, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_init_duration(rcl_duration_t * duration, rcl_time_source_t * time_source);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_init_duration(rcl_duration_t * duration, rcl_time_source_t * time_source);
 | 
			
		||||
 | 
			
		||||
/// Finalize a duration
 | 
			
		||||
/* Finalize the duration such that it is ready for deallocation.
 | 
			
		||||
*
 | 
			
		||||
* This will deallocate all necessary internal structures, and clean up any variables.
 | 
			
		||||
* *
 | 
			
		||||
* \param[in] duration the handle to the duration which is being finalized.
 | 
			
		||||
* \return RCL_RET_OK if the last call time was retrieved successfully, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 *
 | 
			
		||||
 * This will deallocate all necessary internal structures, and clean up any variables.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] duration the handle to the duration which is being finalized.
 | 
			
		||||
 * \return RCL_RET_OK if the last call time was retrieved successfully, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_fini_duration(rcl_duration_t * duration);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_fini_duration(rcl_duration_t * duration);
 | 
			
		||||
 | 
			
		||||
/// Get the default RCL_ROS_TIME time source
 | 
			
		||||
/* This function will get the process default time source.
 | 
			
		||||
* This time source is specifically of the ROS time abstraction,
 | 
			
		||||
* and may be overridden by updates.
 | 
			
		||||
*
 | 
			
		||||
* If the default has not yet been used it will allocate
 | 
			
		||||
* and initialize the time source.
 | 
			
		||||
*
 | 
			
		||||
* \return rcl_time_source_t if it successfully found or allocated a
 | 
			
		||||
          time source. If an error occurred it will return NULL.
 | 
			
		||||
*/
 | 
			
		||||
 * This time source is specifically of the ROS time abstraction,
 | 
			
		||||
 * and may be overridden by updates.
 | 
			
		||||
 *
 | 
			
		||||
 * If the default has not yet been used it will allocate
 | 
			
		||||
 * and initialize the time source.
 | 
			
		||||
 *
 | 
			
		||||
 * \return rcl_time_source_t if it successfully found or allocated a
 | 
			
		||||
 *         time source. If an error occurred it will return NULL.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_time_source_t * rcl_get_default_ros_time_source(void);
 | 
			
		||||
rcl_time_source_t *
 | 
			
		||||
rcl_get_default_ros_time_source(void);
 | 
			
		||||
 | 
			
		||||
/// Get the default RCL_STEADY_TIME time source
 | 
			
		||||
/* This function will get the process default time source.
 | 
			
		||||
* This time source is specifically of the steady time abstraction,
 | 
			
		||||
* it should not be able to be overridden..
 | 
			
		||||
*
 | 
			
		||||
* If the default has not yet been used it will allocate
 | 
			
		||||
* and initialize the time source.
 | 
			
		||||
*
 | 
			
		||||
* \return rcl_time_source_t if it successfully found or allocated a
 | 
			
		||||
          time source. If an error occurred it will return NULL.
 | 
			
		||||
*/
 | 
			
		||||
 * This time source is specifically of the steady time abstraction,
 | 
			
		||||
 * it should not be able to be overridden..
 | 
			
		||||
 *
 | 
			
		||||
 * If the default has not yet been used it will allocate
 | 
			
		||||
 * and initialize the time source.
 | 
			
		||||
 *
 | 
			
		||||
 * \return rcl_time_source_t if it successfully found or allocated a
 | 
			
		||||
 *         time source. If an error occurred it will return NULL.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_time_source_t * rcl_get_default_steady_time_source(void);
 | 
			
		||||
rcl_time_source_t *
 | 
			
		||||
rcl_get_default_steady_time_source(void);
 | 
			
		||||
 | 
			
		||||
/// Get the default RCL_SYSTEM_TIME time source
 | 
			
		||||
/* This function will get the process default time source.
 | 
			
		||||
* This time source is specifically of the system time abstraction,
 | 
			
		||||
* and may be overridden by updates to the system clock.
 | 
			
		||||
*
 | 
			
		||||
* If the default has not yet been used it will allocate
 | 
			
		||||
* and initialize the time source.
 | 
			
		||||
*
 | 
			
		||||
* \return rcl_time_source_t if it successfully found or allocated a
 | 
			
		||||
          time source. If an error occurred it will return NULL.
 | 
			
		||||
*/
 | 
			
		||||
 * This time source is specifically of the system time abstraction,
 | 
			
		||||
 * and may be overridden by updates to the system clock.
 | 
			
		||||
 *
 | 
			
		||||
 * If the default has not yet been used it will allocate
 | 
			
		||||
 * and initialize the time source.
 | 
			
		||||
 *
 | 
			
		||||
 * \return rcl_time_source_t if it successfully found or allocated a
 | 
			
		||||
 *         time source. If an error occurred it will return NULL.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_time_source_t * rcl_get_default_system_time_source(void);
 | 
			
		||||
rcl_time_source_t *
 | 
			
		||||
rcl_get_default_system_time_source(void);
 | 
			
		||||
 | 
			
		||||
/// Set the current time on the RCL_ROS_TIME time source
 | 
			
		||||
/* This function is used to set the time on a ros time source.
 | 
			
		||||
* It will error if passed a differnt time source.
 | 
			
		||||
*
 | 
			
		||||
* This should not block, except on Windows. One caveat is that
 | 
			
		||||
* if the ros time abstraction is active, it will invoke the user
 | 
			
		||||
* defined callbacks, for pre and post update notifications. The
 | 
			
		||||
* calbacks are supposed to be short running and non-blocking.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] process_time_source The time source on which to set the value.
 | 
			
		||||
* \return RCL_RET_OK if the value was set successfully, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 * It will error if passed a differnt time source.
 | 
			
		||||
 *
 | 
			
		||||
 * This should not block, except on Windows. One caveat is that
 | 
			
		||||
 * if the ros time abstraction is active, it will invoke the user
 | 
			
		||||
 * defined callbacks, for pre and post update notifications. The
 | 
			
		||||
 * calbacks are supposed to be short running and non-blocking.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] process_time_source The time source on which to set the value.
 | 
			
		||||
 * \return RCL_RET_OK if the value was set successfully, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_set_default_ros_time_source(rcl_time_source_t * process_time_source);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_set_default_ros_time_source(rcl_time_source_t * process_time_source);
 | 
			
		||||
 | 
			
		||||
/// Compute the difference between two time points
 | 
			
		||||
/* This function takes two time points and computes the duration between them.
 | 
			
		||||
* The two time points must be using the same time abstraction..
 | 
			
		||||
*  And the resultant duration will also be of the same abstraction.
 | 
			
		||||
*
 | 
			
		||||
* The value will be computed as duration = finish - start. If start is after
 | 
			
		||||
* finish the duration will be negative.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] start The time point for the start of the duration.
 | 
			
		||||
* \param[in] finish The time point for the end of the duration.
 | 
			
		||||
* \param[out] delta The duration between the start and finish.
 | 
			
		||||
* \return RCL_RET_OK if the difference was computed successfully, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 * The two time points must be using the same time abstraction, and the
 | 
			
		||||
 * resultant duration will also be of the same abstraction.
 | 
			
		||||
 *
 | 
			
		||||
 * The value will be computed as duration = finish - start. If start is after
 | 
			
		||||
 * finish the duration will be negative.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] start The time point for the start of the duration.
 | 
			
		||||
 * \param[in] finish The time point for the end of the duration.
 | 
			
		||||
 * \param[out] delta The duration between the start and finish.
 | 
			
		||||
 * \return RCL_RET_OK if the difference was computed successfully, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_difference_times(rcl_time_point_t * start, rcl_time_point_t * finish,
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_difference_times(rcl_time_point_t * start, rcl_time_point_t * finish,
 | 
			
		||||
  rcl_duration_t * delta);
 | 
			
		||||
 | 
			
		||||
/// Fill the time point with the current value of the associated clock.
 | 
			
		||||
/* This function will populate the data of the time_point object with the
 | 
			
		||||
* current value from it's associated time abstraction.
 | 
			
		||||
*
 | 
			
		||||
* \param[out] time_point The time_point to populate.
 | 
			
		||||
* \return RCL_RET_OK if the last call time was retrieved successfully, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 * current value from it's associated time abstraction.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[out] time_point The time_point to populate.
 | 
			
		||||
 * \return RCL_RET_OK if the last call time was retrieved successfully, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_get_time_point_now(rcl_time_point_t * time_point);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_get_time_point_now(rcl_time_point_t * time_point);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/// Enable the ros time abstraction override.
 | 
			
		||||
/* This method will enable the ros time abstraction override values,
 | 
			
		||||
* such that the time source will report the set value instead of falling
 | 
			
		||||
* back to system time.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] time_source The time_source to enable.
 | 
			
		||||
* \return RCL_RET_OK if the time source was enabled successfully, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 * such that the time source will report the set value instead of falling
 | 
			
		||||
 * back to system time.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_source The time_source to enable.
 | 
			
		||||
 * \return RCL_RET_OK if the time source was enabled successfully, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_enable_ros_time_override(rcl_time_source_t * time_source);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_enable_ros_time_override(rcl_time_source_t * time_source);
 | 
			
		||||
 | 
			
		||||
/// Disable the ros time abstraction override.
 | 
			
		||||
/* This method will disable the RCL_ROS_TIME time abstraction override values,
 | 
			
		||||
* such that the time source will report the system time even if a custom
 | 
			
		||||
* value has been set.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] time_source The time_source to disable.
 | 
			
		||||
* \return RCL_RET_OK if the time source was disabled successfully, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 * such that the time source will report the system time even if a custom
 | 
			
		||||
 * value has been set.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_source The time_source to disable.
 | 
			
		||||
 * \return RCL_RET_OK if the time source was disabled successfully, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_disable_ros_time_override(rcl_time_source_t * time_source);
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_disable_ros_time_override(rcl_time_source_t * time_source);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/// Check if the RCL_ROS_TIME time source has the override enabled.
 | 
			
		||||
/* This will populate the is_enabled object to indicate if the
 | 
			
		||||
* time overide is enabled. If it is enabled, the set value will be returned.
 | 
			
		||||
* Otherwise this time source will return the equivalent to system time abstraction.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] time_source The time_source to query.
 | 
			
		||||
* \param[out] is_enabled Whether the override is enabled..
 | 
			
		||||
* \return RCL_RET_OK if the time source was queried successfully, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 * time overide is enabled. If it is enabled, the set value will be returned.
 | 
			
		||||
 * Otherwise this time source will return the equivalent to system time abstraction.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_source The time_source to query.
 | 
			
		||||
 * \param[out] is_enabled Whether the override is enabled..
 | 
			
		||||
 * \return RCL_RET_OK if the time source was queried successfully, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_is_enabled_ros_time_override(rcl_time_source_t * time_source,
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_is_enabled_ros_time_override(rcl_time_source_t * time_source,
 | 
			
		||||
  bool * is_enabled);
 | 
			
		||||
 | 
			
		||||
/// Set the current time for this RCL_ROS_TIME time source.
 | 
			
		||||
/* This function will update the internal storage for the RCL_ROS_TIME time source.
 | 
			
		||||
* If queried and override enabled the time source will return this value,
 | 
			
		||||
* otherwise it will return the system time.
 | 
			
		||||
*
 | 
			
		||||
* \param[in] time_source The time_source to update.
 | 
			
		||||
* \param[in] time_value The new current time.
 | 
			
		||||
* \return RCL_RET_OK if the time source was set successfully, or
 | 
			
		||||
*         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
*         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
*/
 | 
			
		||||
 * If queried and override enabled the time source will return this value,
 | 
			
		||||
 * otherwise it will return the system time.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[in] time_source The time_source to update.
 | 
			
		||||
 * \param[in] time_value The new current time.
 | 
			
		||||
 * \return RCL_RET_OK if the time source was set successfully, or
 | 
			
		||||
 *         RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or
 | 
			
		||||
 *         RCL_RET_ERROR an unspecified error occur.
 | 
			
		||||
 */
 | 
			
		||||
RCL_PUBLIC
 | 
			
		||||
RCL_WARN_UNUSED
 | 
			
		||||
rcl_ret_t rcl_set_ros_time_override(rcl_time_source_t * time_source,
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_set_ros_time_override(rcl_time_source_t * time_source,
 | 
			
		||||
  rcl_time_point_value_t time_value);
 | 
			
		||||
 | 
			
		||||
/// Retrieve the current time as a rcl_time_point_value_t (an alias for unint64_t).
 | 
			
		||||
| 
						 | 
				
			
			@ -412,8 +431,8 @@ rcl_ret_t rcl_set_ros_time_override(rcl_time_source_t * time_source,
 | 
			
		|||
 * On Windows this is lock-free if the C11's stdatomic.h function
 | 
			
		||||
 * atomic_is_lock_free() returns true for atomic_int_least64_t.
 | 
			
		||||
 *
 | 
			
		||||
 * TODO(tfoote) I talked with @wjwwood about possibly promoting this
 | 
			
		||||
 *  method into rmw for more reuse.
 | 
			
		||||
 * TODO(tfoote): I talked with @wjwwood about possibly promoting this
 | 
			
		||||
 * method into rmw for more reuse.
 | 
			
		||||
 *
 | 
			
		||||
 * \param[out] now a datafield in which the current time is stored
 | 
			
		||||
 * \return RCL_RET_OK if the current time was successfully obtained, or
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,7 @@
 | 
			
		|||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
#if defined(WIN32)
 | 
			
		||||
| 
						 | 
				
			
			@ -27,9 +28,8 @@ static rcl_time_source_t * rcl_default_ros_time_source;
 | 
			
		|||
static rcl_time_source_t * rcl_default_steady_time_source;
 | 
			
		||||
static rcl_time_source_t * rcl_default_system_time_source;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Internal storage for RCL_ROS_TIME implementation
 | 
			
		||||
typedef struct
 | 
			
		||||
typedef struct rcl_ros_time_source_storage_t
 | 
			
		||||
{
 | 
			
		||||
  atomic_uint_least64_t current_time;
 | 
			
		||||
  bool active;
 | 
			
		||||
| 
						 | 
				
			
			@ -37,21 +37,24 @@ typedef struct
 | 
			
		|||
} rcl_ros_time_source_storage_t;
 | 
			
		||||
 | 
			
		||||
// Implementation only
 | 
			
		||||
rcl_ret_t rcl_get_steady_time(void * data, rcl_time_point_value_t * current_time)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_get_steady_time(void * data, rcl_time_point_value_t * current_time)
 | 
			
		||||
{
 | 
			
		||||
  (void) data;  // unused
 | 
			
		||||
  (void)data;  // unused
 | 
			
		||||
  return rcl_steady_time_now(current_time);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Implementation only
 | 
			
		||||
rcl_ret_t rcl_get_system_time(void * data, rcl_time_point_value_t * current_time)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_get_system_time(void * data, rcl_time_point_value_t * current_time)
 | 
			
		||||
{
 | 
			
		||||
  (void) data;  // unused
 | 
			
		||||
  (void)data;  // unused
 | 
			
		||||
  return rcl_system_time_now(current_time);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Internal method for zeroing values on init, assumes time_source is valid
 | 
			
		||||
void rcl_init_generic_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
void
 | 
			
		||||
rcl_init_generic_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
{
 | 
			
		||||
  time_source->type = RCL_TIME_SOURCE_UNINITIALIZED;
 | 
			
		||||
  time_source->pre_update = NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -62,7 +65,8 @@ void rcl_init_generic_time_source(rcl_time_source_t * time_source)
 | 
			
		|||
 | 
			
		||||
// The function used to get the current ros time.
 | 
			
		||||
// This is in the implementation only
 | 
			
		||||
rcl_ret_t rcl_get_ros_time(void * data, rcl_time_point_value_t * current_time)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_get_ros_time(void * data, rcl_time_point_value_t * current_time)
 | 
			
		||||
{
 | 
			
		||||
  rcl_ros_time_source_storage_t * t = (rcl_ros_time_source_storage_t *)data;
 | 
			
		||||
  if (!t->active) {
 | 
			
		||||
| 
						 | 
				
			
			@ -72,7 +76,8 @@ rcl_ret_t rcl_get_ros_time(void * data, rcl_time_point_value_t * current_time)
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool rcl_time_source_valid(rcl_time_source_t * time_source)
 | 
			
		||||
bool
 | 
			
		||||
rcl_time_source_valid(rcl_time_source_t * time_source)
 | 
			
		||||
{
 | 
			
		||||
  if (time_source == NULL ||
 | 
			
		||||
    time_source->type == RCL_TIME_SOURCE_UNINITIALIZED ||
 | 
			
		||||
| 
						 | 
				
			
			@ -83,7 +88,8 @@ bool rcl_time_source_valid(rcl_time_source_t * time_source)
 | 
			
		|||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_init_ros_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_init_ros_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_source, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  rcl_init_generic_time_source(time_source);
 | 
			
		||||
| 
						 | 
				
			
			@ -93,7 +99,8 @@ rcl_ret_t rcl_init_ros_time_source(rcl_time_source_t * time_source)
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_fini_ros_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_fini_ros_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_source, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  if (time_source->type != RCL_ROS_TIME) {
 | 
			
		||||
| 
						 | 
				
			
			@ -104,7 +111,8 @@ rcl_ret_t rcl_fini_ros_time_source(rcl_time_source_t * time_source)
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_init_steady_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_init_steady_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_source, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  rcl_init_generic_time_source(time_source);
 | 
			
		||||
| 
						 | 
				
			
			@ -113,7 +121,8 @@ rcl_ret_t rcl_init_steady_time_source(rcl_time_source_t * time_source)
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_fini_steady_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_fini_steady_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_source, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  if (time_source->type != RCL_STEADY_TIME) {
 | 
			
		||||
| 
						 | 
				
			
			@ -123,19 +132,18 @@ rcl_ret_t rcl_fini_steady_time_source(rcl_time_source_t * time_source)
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_init_system_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_init_system_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_source, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  rcl_init_generic_time_source(time_source);
 | 
			
		||||
  time_source->get_now = rcl_get_system_time;
 | 
			
		||||
  time_source->type = RCL_SYSTEM_TIME;
 | 
			
		||||
  if (!time_source) {
 | 
			
		||||
    return RCL_RET_ERROR;
 | 
			
		||||
  }
 | 
			
		||||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_fini_system_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_fini_system_time_source(rcl_time_source_t * time_source)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_source, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  if (time_source->type != RCL_SYSTEM_TIME) {
 | 
			
		||||
| 
						 | 
				
			
			@ -145,7 +153,8 @@ rcl_ret_t rcl_fini_system_time_source(rcl_time_source_t * time_source)
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_init_time_point(rcl_time_point_t * time_point, rcl_time_source_t * time_source)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_init_time_point(rcl_time_point_t * time_point, rcl_time_source_t * time_source)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_point, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  if (!time_source) {
 | 
			
		||||
| 
						 | 
				
			
			@ -157,14 +166,16 @@ rcl_ret_t rcl_init_time_point(rcl_time_point_t * time_point, rcl_time_source_t *
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_fini_time_point(rcl_time_point_t * time_point)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_fini_time_point(rcl_time_point_t * time_point)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_point, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  (void) time_point;
 | 
			
		||||
  (void)time_point;
 | 
			
		||||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_init_duration(rcl_duration_t * duration, rcl_time_source_t * time_source)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_init_duration(rcl_duration_t * duration, rcl_time_source_t * time_source)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(duration, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  if (!time_source) {
 | 
			
		||||
| 
						 | 
				
			
			@ -176,17 +187,19 @@ rcl_ret_t rcl_init_duration(rcl_duration_t * duration, rcl_time_source_t * time_
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_fini_duration(rcl_duration_t * duration)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_fini_duration(rcl_duration_t * duration)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(duration, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  (void) duration;
 | 
			
		||||
  (void)duration;
 | 
			
		||||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_time_source_t * rcl_get_default_ros_time_source(void)
 | 
			
		||||
rcl_time_source_t *
 | 
			
		||||
rcl_get_default_ros_time_source(void)
 | 
			
		||||
{
 | 
			
		||||
  if (!rcl_default_ros_time_source) {
 | 
			
		||||
    rcl_default_ros_time_source = calloc(1, sizeof(rcl_time_source_t));
 | 
			
		||||
    rcl_default_ros_time_source = (rcl_time_source_t *)calloc(1, sizeof(rcl_time_source_t));
 | 
			
		||||
    rcl_ret_t retval = rcl_init_ros_time_source(rcl_default_ros_time_source);
 | 
			
		||||
    if (retval != RCL_RET_OK) {
 | 
			
		||||
      return NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -195,10 +208,11 @@ rcl_time_source_t * rcl_get_default_ros_time_source(void)
 | 
			
		|||
  return rcl_default_ros_time_source;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_time_source_t * rcl_get_default_steady_time_source(void)
 | 
			
		||||
rcl_time_source_t *
 | 
			
		||||
rcl_get_default_steady_time_source(void)
 | 
			
		||||
{
 | 
			
		||||
  if (!rcl_default_steady_time_source) {
 | 
			
		||||
    rcl_default_steady_time_source = calloc(1, sizeof(rcl_time_source_t));
 | 
			
		||||
    rcl_default_steady_time_source = (rcl_time_source_t *)calloc(1, sizeof(rcl_time_source_t));
 | 
			
		||||
    rcl_ret_t retval = rcl_init_steady_time_source(rcl_default_steady_time_source);
 | 
			
		||||
    if (retval != RCL_RET_OK) {
 | 
			
		||||
      return NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -207,10 +221,11 @@ rcl_time_source_t * rcl_get_default_steady_time_source(void)
 | 
			
		|||
  return rcl_default_steady_time_source;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_time_source_t * rcl_get_default_system_time_source(void)
 | 
			
		||||
rcl_time_source_t *
 | 
			
		||||
rcl_get_default_system_time_source(void)
 | 
			
		||||
{
 | 
			
		||||
  if (!rcl_default_system_time_source) {
 | 
			
		||||
    rcl_default_system_time_source = calloc(1, sizeof(rcl_time_source_t));
 | 
			
		||||
    rcl_default_system_time_source = (rcl_time_source_t *)calloc(1, sizeof(rcl_time_source_t));
 | 
			
		||||
    rcl_ret_t retval = rcl_init_system_time_source(rcl_default_system_time_source);
 | 
			
		||||
    if (retval != RCL_RET_OK) {
 | 
			
		||||
      return NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -219,7 +234,8 @@ rcl_time_source_t * rcl_get_default_system_time_source(void)
 | 
			
		|||
  return rcl_default_system_time_source;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_set_default_ros_time_source(rcl_time_source_t * process_time_source)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_set_default_ros_time_source(rcl_time_source_t * process_time_source)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(process_time_source, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  if (rcl_default_ros_time_source) {
 | 
			
		||||
| 
						 | 
				
			
			@ -229,7 +245,8 @@ rcl_ret_t rcl_set_default_ros_time_source(rcl_time_source_t * process_time_sourc
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_difference_times(rcl_time_point_t * start, rcl_time_point_t * finish,
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_difference_times(rcl_time_point_t * start, rcl_time_point_t * finish,
 | 
			
		||||
  rcl_duration_t * delta)
 | 
			
		||||
{
 | 
			
		||||
  if (start->time_source->type != finish->time_source->type) {
 | 
			
		||||
| 
						 | 
				
			
			@ -244,7 +261,8 @@ rcl_ret_t rcl_difference_times(rcl_time_point_t * start, rcl_time_point_t * fini
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_get_time_point_now(rcl_time_point_t * time_point)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_get_time_point_now(rcl_time_point_t * time_point)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_point, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  if (time_point->time_source && time_point->time_source->get_now) {
 | 
			
		||||
| 
						 | 
				
			
			@ -255,7 +273,8 @@ rcl_ret_t rcl_get_time_point_now(rcl_time_point_t * time_point)
 | 
			
		|||
  return RCL_RET_ERROR;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_enable_ros_time_override(rcl_time_source_t * time_source)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_enable_ros_time_override(rcl_time_source_t * time_source)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_source, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  if (time_source->type != RCL_ROS_TIME) {
 | 
			
		||||
| 
						 | 
				
			
			@ -272,7 +291,8 @@ rcl_ret_t rcl_enable_ros_time_override(rcl_time_source_t * time_source)
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_disable_ros_time_override(rcl_time_source_t * time_source)
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_disable_ros_time_override(rcl_time_source_t * time_source)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_source, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
  if (time_source->type != RCL_ROS_TIME) {
 | 
			
		||||
| 
						 | 
				
			
			@ -288,7 +308,9 @@ rcl_ret_t rcl_disable_ros_time_override(rcl_time_source_t * time_source)
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_is_enabled_ros_time_override(rcl_time_source_t * time_source,
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_is_enabled_ros_time_override(
 | 
			
		||||
  rcl_time_source_t * time_source,
 | 
			
		||||
  bool * is_enabled)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_source, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
| 
						 | 
				
			
			@ -306,7 +328,9 @@ rcl_ret_t rcl_is_enabled_ros_time_override(rcl_time_source_t * time_source,
 | 
			
		|||
  return RCL_RET_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
rcl_ret_t rcl_set_ros_time_override(rcl_time_source_t * time_source,
 | 
			
		||||
rcl_ret_t
 | 
			
		||||
rcl_set_ros_time_override(
 | 
			
		||||
  rcl_time_source_t * time_source,
 | 
			
		||||
  rcl_time_point_value_t time_value)
 | 
			
		||||
{
 | 
			
		||||
  RCL_CHECK_ARGUMENT_FOR_NULL(time_source, RCL_RET_INVALID_ARGUMENT);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue