Obtendo o tempo em C
Neste script, o tempo do sistema (horário e data) é obtido através da linguagem C.
Descrição
Neste script, o tempo do sistema (horário e data) é obtido através da linguagem C.
#include <stdio.h>
#include <time.h>
int main(){
time_t t = time(0);
struct tm *tempo = localtime(&t);
printf("A data hoje é: %.2d/%.2d/%.2d\n", tempo->tm_mday, tempo->tm_mon+1, tempo->tm_year+1900);
printf("O horário é: %.2d:%.2d:%.2d\n", tempo->tm_hour, tempo->tm_min, tempo->tm_sec);
return 0;
}