tv_to_double(const struct timeval *tv)
{
  double conv = tv->tv_sec;
  conv += tv->tv_usec/1000000.0;
  return conv;
}
tv_to_double(const struct timeval *tv)
{
  double conv = tv->tv_sec;
  conv += tv->tv_usec/1000000.0;
  return conv;
}