Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
timeops Namespace Reference

Namespace containing functions related to operations on time and date related data types. More...

Functions

std::string GetTimestamp (const std::string &szFormat="%Y%m%d-%H%M%S")
 Accessor for getting the current time in a specified format.
 

Detailed Description

Namespace containing functions related to operations on time and date related data types.

Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2025-01-07

Function Documentation

◆ GetTimestamp()

std::string timeops::GetTimestamp ( const std::string &  szFormat = "%Y%m%d-%H%M%S")
inline

Accessor for getting the current time in a specified format.

Parameters
szFormat- The format to return the time in.
Returns
std::string - The current time in the specified format.
Author
Eli Byrd (edbgk.nosp@m.k@ms.nosp@m.t.edu)
Date
2025-01-07
43 {
44 // Retrieve the current time
45 auto now = std::chrono::system_clock::now();
46 time_t timeNow = std::chrono::system_clock::to_time_t(now);
47
48 // Convert to local time (thread-safe)
49 tm localTime{};
50 localtime_r(&timeNow, &localTime);
51
52 // Format the time
53 std::ostringstream oss;
54 oss << std::put_time(&localTime, szFormat.c_str());
55 return oss.str();
56 }
Here is the caller graph for this function: