rtnMichael
Programmer
Hey guys, if I wanted to get the current time in seconds, how would I do it with Ctime....or maybe I don't even use Ctime. Please help
Thanks
Mike
Thanks
Mike
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <stdio.h>
int main ( void ) {
struct stat sb;
time_t now = time(NULL);
stat( "a.out", &sb );
printf( "Seconds since last modification=%f\n", difftime(now,sb.st_mtime) );
return 0;
}
now - sb.st_mtime
man difftime