#include <stdio.h>
#include <time.h>
int main (void) {
//O tempo em segundos desde 1 JAN 1970 00:00:00 ate este momento
printf ("%d\n", time((time_t*)NULL));
//Um apontador time_t com o mesmo tempo(uns milesimos de segundo adiantado, dependendo do processador)
time_t t = time((time_t*)NULL);
//Uma struct tm que ja existe da biblioteca do c
struct tm tempo;
/* Composicao da struct tm
struct tm {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
}
*/
//Converter para uma struct tm, um time_t
tempo = *localtime_r(&t, &tempo);
//guardar para uma string um output desejado
char str[40];
strftime(str, (sizeof(char)*40),"DATA: \t%d-%m-%y \nHORA: \t%H:%M:%S",&tempo);
printf("%s\n", str);
return 0;
}