Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
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);