gpsdate: log the actual time that was set to the RTC.
This commit is contained in:
parent
f56f16539b
commit
3b870221a9
|
@ -46,6 +46,7 @@ static struct gps_data_t gpsdata;
|
||||||
static void callback(struct gps_data_t *gpsdata)
|
static void callback(struct gps_data_t *gpsdata)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
time_t time;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (!(gpsdata->set & TIME_SET))
|
if (!(gpsdata->set & TIME_SET))
|
||||||
|
@ -55,10 +56,13 @@ static void callback(struct gps_data_t *gpsdata)
|
||||||
/* FIXME: use the fractional part for microseconds */
|
/* FIXME: use the fractional part for microseconds */
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
|
|
||||||
|
time = tv.tv_sec;
|
||||||
|
|
||||||
rc = settimeofday(&tv, NULL);
|
rc = settimeofday(&tv, NULL);
|
||||||
gps_close(gpsdata);
|
gps_close(gpsdata);
|
||||||
if (rc == 0) {
|
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();
|
closelog();
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue