Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Setting the system time?: (2 Items)
   
Setting the system time?  
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?
Re: Setting the system time?  
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);