19 std::string time_as_string;
20 struct tm local_time = { };
22 if (retval !=
nullptr)
24 char str[128]{
'\0' };
25 strftime(str,
sizeof str,
"%m/%d/%Y %r", &local_time);
29 return time_as_string;
37 auto now_time = std::chrono::system_clock::now();
38 auto now_time_t = std::chrono::system_clock::to_time_t(now_time);
Represents a timestamp composed of a date and a time encoded in a time_t value. Provides ways of gett...
static DateTime Now()
Return the current date and time.
DateTime()
Default constructor.
std::string ToString()
Format the DateTime as a string. The format is "standard" (in this case, preset to 02/22/2023 10:26:1...
Declaration of the DateTime class to simplify getting the local time as a string (modeled after the C...
Declaration of the makelocaltime() function to convert a time_t to a struct tm containing the local t...
The namespace containing all the "helper" functions in the C++ code.
struct tm * makelocaltime(const time_t *time, struct tm *timestruct)
Convert the given time to local time.