Advertisement
ak02

App.c

May 29th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int main()
  6. {
  7. time_t now;
  8. int h, m, s, d, mon, an;
  9.  
  10. time(&now);
  11.  
  12. printf("il est %s\n", ctime(&now));
  13.  
  14. struct tm *local = localtime(&now);
  15.  
  16. h = local->tm_hour;
  17. m = local->tm_min;
  18. s = local->tm_sec;
  19. d = local->tm_mday;
  20. mon = local->tm_mon + 1;
  21. an = local->tm_year + 1900;
  22.  
  23. printf("Heure actuelle : %02d:%02d:%02d\n", h,m,s);
  24. printf("Date courante : %02d/%02d/%d\n", d, mon, an);
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement