Write a C program that displays the real time of a day every 60 seconds - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Thursday, October 6, 2011

Write a C program that displays the real time of a day every 60 seconds


Write a C program that displays the real time of a day every 60 seconds


     #include <stdio.h>
     #include <sys/time.h>      
     #include <sys/signal.h>


/* Declarations */
         void main();
     int times_up();


     void main()
     {


        for (; ;)
{
  times_up(1);
sleep(60);


}                         
     }


 int times_up(sig)
     int sig;                             
     {
       long now;
       long  time(struct tms *ptr);
        char *ctime();


        time (&now);
        printf("It is now %s\n", ctime (&now));
return (sig);
     }

No comments:

Post a Comment