what is the difference between difftime and ‘-‘?

The language specifies that time_t is an arithmetic type capable of representing times. It doesn’t require it to represent times in any particular way. If time_t represents time as the number of seconds since some moment, the – operator will correctly compute the difference in seconds between two time_t values. If it doesn’t (say, if … Read more

Get the current time in C [duplicate]

Copy-pasted from here: /* localtime example */ #include <stdio.h> #include <time.h> int main () { time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); printf ( “Current local time and date: %s”, asctime (timeinfo) ); return 0; } (just add void to the main() arguments list in order … Read more