14 static char str[128] = {
'\0' };
15 struct tm local_time = { 0 };
16 struct tm* timestruct =
makelocaltime(×tamp, &local_time);
17 if (timestruct != NULL)
19 strftime(str,
sizeof(str),
"%m/%d/%Y %r", &local_time);
time_t datetime_now(void)
Retrieve a time stamp that represents the current time.
const char * datetime_to_string(time_t timestamp)
Convert the specified time stamp to a string.
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...
struct tm * makelocaltime(const time_t *time, struct tm *timestruct)
Convert the given time to local time.