I\'m writing a socket program that maintains FIFO queues for two input sockets. When deciding which queue to service, the program pulls the most recent time-stamp from each
For viewing timevals I just whipped this up. It returns a timeval as a string that you can print or send to a text file:
char *tv2str(struct timeval *intv) {
static char ans[200];
snprintf(ans,200,"%u.%u",(unsigned int)intv->tv_sec, \
(unsigned int) intv->tv_usec);
return ans;
}
Use like:
printf("nowtv: %s\n",tv2str(&nowtv));
nowtv: 1568407554.646623
Timercmp() didn't seem to work right so I wanted a way to check up on it by actually looking at some values.