-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VT]: Cleanup system timing comments, whitespace
- Loading branch information
Showing
2 changed files
with
33 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,34 @@ | ||
//================================================================================================ | ||
/// @file system_timing.cpp | ||
/// | ||
/// @brief Utility class for getting system time and handling u32 time rollover | ||
/// @author Adrian Del Grosso | ||
/// | ||
/// @copyright 2022 Adrian Del Grosso | ||
//================================================================================================ | ||
|
||
#include <cstdint> | ||
|
||
namespace isobus | ||
{ | ||
|
||
class SystemTiming | ||
{ | ||
public: | ||
static std::uint32_t get_timestamp_ms(); | ||
static std::uint64_t get_timestamp_us(); | ||
class SystemTiming | ||
{ | ||
public: | ||
static std::uint32_t get_timestamp_ms(); | ||
static std::uint64_t get_timestamp_us(); | ||
|
||
static std::uint32_t get_time_elapsed_ms(std::uint32_t timestamp_ms); | ||
static std::uint64_t get_time_elapsed_us(std::uint64_t timestamp_us); | ||
static std::uint32_t get_time_elapsed_ms(std::uint32_t timestamp_ms); | ||
static std::uint64_t get_time_elapsed_us(std::uint64_t timestamp_us); | ||
|
||
static bool time_expired_ms(std::uint32_t timestamp_ms, std::uint32_t timeout_ms); | ||
static bool time_expired_us(std::uint64_t timestamp_us, std::uint64_t timeout_us); | ||
static bool time_expired_ms(std::uint32_t timestamp_ms, std::uint32_t timeout_ms); | ||
static bool time_expired_us(std::uint64_t timestamp_us, std::uint64_t timeout_us); | ||
|
||
private: | ||
static std::uint32_t incrementing_difference(std::uint32_t currentValue, std::uint32_t previousValue); | ||
static std::uint64_t incrementing_difference(std::uint64_t currentValue, std::uint64_t previousValue); | ||
static std::uint64_t s_timestamp_ms; | ||
static std::uint64_t s_timestamp_us; | ||
}; | ||
private: | ||
static std::uint32_t incrementing_difference(std::uint32_t currentValue, std::uint32_t previousValue); | ||
static std::uint64_t incrementing_difference(std::uint64_t currentValue, std::uint64_t previousValue); | ||
static std::uint64_t s_timestamp_ms; | ||
static std::uint64_t s_timestamp_us; | ||
}; | ||
|
||
} // namespace isobus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters