GAGBOX is your one source to humor and fun

15 January, 2009

C Program to Set/Change the Current System Time

This program can be used to set or change the system time

#include
#include

int main(void)
{
struct time t;
gettime(&t);
printf(”The current hour is: %d\n”, t.ti_hour);
printf(”The current min is: %d\n”, t.ti_min);
printf(”The current second is: %d\n”, t.ti_sec);

/* Add one to the hour,minute & sec struct element and then call settime */

t.ti_hour++;
t.ti_min++;
t.ti_sec++;
settime(&t);
printf(”The current hour is: %d\n”, t.ti_hour);
printf(”The current min is: %d\n”, t.ti_min);
printf(”The current second is: %d\n”, t.ti_sec);
return 0;
}

Share Your Thoughts!

0 comments:

Post a Comment

Copyright © 2013 GagBox™ is a registered trademark.

Designed by GagBox Inc. Desiged By Templateism.com. Blogger Hosting by Blogger.