#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>

typedef struct {
  // if you allocate structures here...
  struct timeval tv;
  struct timezone tz;
} Time;

Time *make_time ()
{
  Time *time = (Time *) malloc (sizeof(Time));
  return time;
}

double get_seconds(Time *time)
{
  // then you have to mix -> and . notation ...
  return time->tv.tv_sec + time->tv.tv_usec / 1e6;
}

int get_time(Time *time)
{
  // and you need the ampersands here.
  return gettimeofday(&time->tv, &time->tz);
}

int main()
{
  Time *time = make_time();
  get_time(time);

  double x = get_seconds(time);
  printf ("%f\n", x);
}

