C Program to get Current Time

This program reads the current system time and displays it in the form HH:MM:SS

#include <stdio.h>
#include <dos.h>

int main(void)

{
struct time t;
gettime(&t);
printf(“The current time is: %2d:%02d:%02d\n”, t.ti_hour, t.ti_min, t.ti_sec);
return 0;
}

People who read this also read:

  • No Related Posts
13 Comments
  1. December 20, 2010
    • December 22, 2010
  2. December 30, 2010
    • January 4, 2011
  3. January 4, 2011
    • January 13, 2011
  4. January 13, 2011
  5. January 16, 2011
  6. January 18, 2011
  7. January 24, 2011
  8. January 25, 2011
  9. April 22, 2011
  10. December 11, 2012

Leave a Reply

Your email address will not be published. Required fields are marked *