WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
timestamp.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <stdint.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/**
14 * The default implementation used for Now().
15 * In general this is the time returned by the operating system.
16 * @return Time in microseconds.
17 */
18uint64_t WPI_NowDefault(void);
19
20/**
21 * Set the implementation used by WPI_Now().
22 * The implementation must return monotonic time in microseconds to maintain
23 * the contract of WPI_Now().
24 * @param func Function called by WPI_Now() to return the time.
25 */
26void WPI_SetNowImpl(uint64_t (*func)(void));
27
28/**
29 * Return a value representing the current time in microseconds.
30 * The epoch is not defined.
31 * @return Time in microseconds.
32 */
33uint64_t WPI_Now(void);
34
35/**
36 * Return the current system time in microseconds since the Unix epoch
37 * (January 1st, 1970 00:00 UTC).
38 *
39 * @return Time in microseconds.
40 */
41uint64_t WPI_GetSystemTime(void);
42
43#ifdef __cplusplus
44} // extern "C"
45#endif
void WPI_SetNowImpl(uint64_t(*func)(void))
Set the implementation used by WPI_Now().
uint64_t WPI_NowDefault(void)
The default implementation used for Now().
uint64_t WPI_Now(void)
Return a value representing the current time in microseconds.
uint64_t WPI_GetSystemTime(void)
Return the current system time in microseconds since the Unix epoch (January 1st, 1970 00:00 UTC).