I\'m trying to print the values in a struct timeval
variable as follows:
int main()
{
struct timeval *cur;
do_gettimeofday(cur);
The variable cur
is a pointer of type timeval. You need to have a timeval variable and pass it's address to the function. Something like:
struct timeval cur;
do_gettimeofday(&cur);
You also need
#include
which has the definition of the struct timeval and declaration of the function do_gettimeofday
.
Alternatively you can use the gettimeofday
function from sys/time.h
.
Working link