Saturday, 31 May 2014

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: