ahmed0saber

Digital clock in C

Nov 4th, 2020
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <time.h>
  3. int main()
  4. {
  5.     time_t s, val = 1;
  6.     struct tm* current_time;
  7.  
  8.     s = time(NULL);
  9.  
  10.     current_time = localtime(&s);
  11.  
  12.     printf("%02d:%02d:%02d",
  13.            current_time->tm_hour,
  14.            current_time->tm_min,
  15.            current_time->tm_sec);
  16.  
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment