summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-04-10 12:23:16 +0200
committerHarald Welte <laforge@gnumonks.org>2013-04-10 12:23:16 +0200
commit3b870221a9b9c50e0d9a0848b4eb842ddd21c54f (patch)
tree01c4b46b2bb1ee101cfde24af5a9e9d0e2f03537
parentf56f16539b8a8ccf6d167ac3ff5fec9f940c5f39 (diff)
downloadgpsdate-3b870221a9b9c50e0d9a0848b4eb842ddd21c54f.tar.gz
gpsdate-3b870221a9b9c50e0d9a0848b4eb842ddd21c54f.tar.bz2
gpsdate-3b870221a9b9c50e0d9a0848b4eb842ddd21c54f.tar.xz
gpsdate-3b870221a9b9c50e0d9a0848b4eb842ddd21c54f.zip
gpsdate: log the actual time that was set to the RTC.
-rw-r--r--gpsdate.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gpsdate.c b/gpsdate.c
index f78537a..c424330 100644
--- a/gpsdate.c
+++ b/gpsdate.c
@@ -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 {