gpsdate: log the actual time that was set to the RTC.

This commit is contained in:
Harald Welte 2013-04-10 12:23:16 +02:00
parent f56f16539b
commit 3b870221a9
1 changed files with 5 additions and 1 deletions

View File

@ -46,6 +46,7 @@ static struct gps_data_t gpsdata;
static void callback(struct gps_data_t *gpsdata)
{
struct timeval tv;
time_t time;
int rc;
if (!(gpsdata->set & TIME_SET))
@ -55,10 +56,13 @@ static void callback(struct gps_data_t *gpsdata)
/* FIXME: use the fractional part for microseconds */
tv.tv_usec = 0;
time = tv.tv_sec;
rc = settimeofday(&tv, NULL);
gps_close(gpsdata);
if (rc == 0) {
syslog(LOG_NOTICE, "Successfully set RTC time to GPSD time\n");
syslog(LOG_NOTICE, "Successfully set RTC time to GPSD time:"
" %s", ctime(&time));
closelog();
exit(EXIT_SUCCESS);
} else {