1# include <stdio.h>
2# include <time.h>
3
4 int main(void)
5 {
6 time_t now;
7 struct tm ts;
8 char buf[80];
9
10 // Obtem o tempo corrente
11 now = time(NULL);
12
13 // Formata e imprime o tempo, "ddd yyyy-mm-dd hh:mm:ss zzz"
14 ts = *localtime(&now);
15 strftime(buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", &ts);
16 printf("%s\n", buf);
17
18 return 0;
19 }
20