current UPC time and timeval

Hi,

I receive a message with a field of timeval, which is UPC time. I would like to get the time of today at 12:00:00 am in the format of timeval so I can calculate the seconds elapsed from 12am to the message timestamp.
I am not sure the starting time for UPC time to calculate sec field in timeval. Are there a existing functions to do this in LINUX?

Thanks

Do you mean UTC? http://en.wikipedia.org/wiki/Coordinated_Universal_Time. Virtually all Unix time functions work in terms of UTC. It isn't until you call something like localtime() where the timezone is taken into account. gmtime() will break a time_t (the seconds part of a timeval) into date and time components in UTC. mktime() is the inverse.

http://www.cplusplus.com/reference/clibrary/ctime/gmtime/
http://www.cplusplus.com/reference/clibrary/ctime/mktime/
Topic archived. No new replies allowed.