Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <time.h>
#include <string.h>
#include <errno.h>
#define LOGGER_TIME_SIZE 16
int main() {
time_t clock;
struct tm lt;
char formatted_time_[LOGGER_TIME_SIZE];
time(&clock);
localtime_r(&clock, &lt);
strftime(formatted_time_, LOGGER_TIME_SIZE, "%b %e %H:%M:%S", &lt);
return errno; // returns EINVAL, 22 which is set by strftime
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment