To avoid the warnings
double mytimer(struct timeval * start, struct timeval * end) {
long usec = end->tv_usec - start->tv_usec;
long sec = end->tv_sec - start->tv_sec;
return 1.0 * sec + 1e-6 * usec;
}
If you see the datatypes defined in
, inherently you'll find
typedef long time_t;
...
typedef long suseconds_t;
There are no specific format specifiers for struct timeval
but the structure members are of type long. Hope this solves your problem.