nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

clock_settime.patch (592B)


      1 diff --git i/gpsdate.c w/gpsdate.c
      2 index 969bbdc..fe10276 100644
      3 --- i/gpsdate.c
      4 +++ w/gpsdate.c
      5 @@ -104,10 +104,11 @@ static void process_message(const char *msgid, const char **data)
      6  			t->tm_sec = seconds;
      7  
      8  			/* Set new system time: */
      9 -			time_t gps_time = mktime(t);
     10 -			gps_time += t->tm_gmtoff;
     11 +			struct timespec gps_time;
     12 +			gps_time.tv_sec = mktime(t) + t->tm_gmtoff;
     13 +			gps_time.tv_nsec = 0;
     14  
     15 -			if (stime(&gps_time) == 0) {
     16 +			if (clock_settime(CLOCK_REALTIME, &gps_time) == 0) {
     17  				printf("Successfully updated local time.\n");
     18  				date_changed = true;
     19  			} else {