Advertisement
jacob_segundo

Time&Date

Dec 15th, 2021
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. #include<time.h>
  4.  int main(){
  5.     int i;
  6.     system("title Hora_Atual");
  7.    
  8.     struct tm *Horario;//ponteiro
  9.     time_t hora; //variavel
  10.    
  11.     time(&hora);
  12.    
  13.     Horario=localtime(&hora);
  14.     printf("\tHora e data atual\n");
  15.     //macro time
  16.     printf("%s  %s\n",__TIME__ ,__DATE__);
  17.     printf("Dia da semana %d\n",Horario->tm_wday+1);
  18.     printf("Dia do ano %d\n",Horario->tm_yday);
  19.     //testa se existe horaio de verao
  20.     i=(Horario->tm_isdst);
  21.     if(i==0)
  22.     printf("nao ha horario de verao\n");
  23.     else
  24.     printf("horario de verao %d\n",Horario->tm_isdst);
  25.    
  26.     return 0;
  27.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement