I have a thread which obtains the time from NMEA GPS string, I want to use this time to set the system clock. I can spawn date but I would rather use clock_settime(). How can I translate, year, month, day, hours, minutes and seconds into a timespec for use with clock_settime?
Resolved: struct tm gpsTD; gpsTD.tm_year = intYear - 1900; gpsTD.tm_mon = intMonth - 1; gpsTD.tm_mday = intDay; gpsTD.tm_hour = intHrs; gpsTD.tm_min = intMins; gpsTD.tm_sec = (int)fSecs; gpsTD.tm_isdst = 0; tGPS = mktime(&gpsTD);