WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
timestamp.hpp
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
9namespace wpi::util {
10
11/**
12 * The default implementation used for Now().
13 * In general this is the time returned by the operating system.
14 * @return Time in microseconds.
15 */
16uint64_t NowDefault();
17
18/**
19 * Set the implementation used by Now().
20 * The implementation must return monotonic time in microseconds to maintain
21 * the contract of Now().
22 * @param func Function called by Now() to return the time.
23 */
24void SetNowImpl(uint64_t (*func)());
25
26/**
27 * Return a value representing the current time in microseconds.
28 * This is a monotonic clock with an undefined epoch.
29 * @return Time in microseconds.
30 */
31uint64_t Now();
32
33/**
34 * Return the current system time in microseconds since the Unix epoch
35 * (January 1st, 1970 00:00 UTC).
36 *
37 * @return Time in microseconds.
38 */
39uint64_t GetSystemTime();
40
41} // namespace wpi::util
Definition raw_os_ostream.hpp:19
void SetNowImpl(uint64_t(*func)())
Set the implementation used by Now().
uint64_t NowDefault()
The default implementation used for Now().
uint64_t GetSystemTime()
Return the current system time in microseconds since the Unix epoch (January 1st, 1970 00:00 UTC).
uint64_t Now()
Return a value representing the current time in microseconds.