#include "time.h" #include #include #define VALUE_SIZE 32 struct time { char value[VALUE_SIZE]; }; struct time * time_new() { struct time * t = malloc(sizeof(struct time)); return t; } void time_free(struct time * t) { free(t); } void time_update(struct time * t) { time_t timer; struct tm * tm; time(&timer); tm = localtime(&timer); strftime(t->value, VALUE_SIZE, "%F [%a] %T", tm); } const char * time_get_val(struct time * t) { return t->value; }