|
From: David C. <bey...@gm...> - 2006-06-06 01:37:42
|
Hi All,
I've a question on how to convert struct timeval into microsecond.
#include <sys/time.h>
struct timeval {
time_t sec;
suseconds_t usec;
};
What I'm doing right now is the follow:
struct timeval currentTime;
long timeInLong;
gettimeofday(¤tTime, 0);
// converts sec to microseconds
timeInLong = currentTime.tv_sec * 1000000;
// Adds the microsecond together with the converted second.
timeInLong += sendTime.tv_usec;
Does this look correct to you guys?
Thanks,
David
|