#include <sys/time.h>
#include<stdio.h>
int main()
{
struct timeval current_time;
struct timeval past_time;
gettimeofday(¤t_time,NULL); // This function will update structure timeval with current time stamp.
past_time.tv_sec = 1351257149; //.tv_sec holds time value in seconds. I have hard coded a value for it directly.
printf("The difference between past and present time = %ld",current_time.tv_sec-past_time.tv_sec );
return 0;
}
#include<stdio.h>
int main()
{
struct timeval current_time;
struct timeval past_time;
gettimeofday(¤t_time,NULL); // This function will update structure timeval with current time stamp.
past_time.tv_sec = 1351257149; //.tv_sec holds time value in seconds. I have hard coded a value for it directly.
printf("The difference between past and present time = %ld",current_time.tv_sec-past_time.tv_sec );
return 0;
}
No comments:
Post a Comment