diff options
Diffstat (limited to 'src/nssync.c')
-rw-r--r-- | src/nssync.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/nssync.c b/src/nssync.c index 93fa7fb..d10ce05 100644 --- a/src/nssync.c +++ b/src/nssync.c @@ -19,6 +19,7 @@ #include <fcntl.h> #include "runcap.h" #include <sys/types.h> +#include <sys/time.h> #include <signal.h> #include <syslog.h> @@ -37,6 +38,9 @@ struct json_value *changed_zones; int check_ns; int server_mode; struct grecs_sockaddr *server_addr; +unsigned periodic_timeout = 3600; +unsigned delay_timeout = 30; + int syslog_facility = LOG_DAEMON; char *syslog_tag; int foreground; @@ -607,12 +611,19 @@ nssync(struct json_value **ret_json) } if (ret_json) { - struct json_value *json = json_new_object(); + struct timeval tv; + struct timezone tz; + struct json_value *json; + + json = json_new_object(); json_object_set(json, "success", json_new_bool(!res)); if (json_array_size(changed_zones) > 0) json_object_set(json, "zones", changed_zones); if (json_array_size(error_list) > 0) json_object_set(json, "errors", error_list); + gettimeofday(&tv, &tz); + tv.tv_sec += tz.tz_minuteswest * 60; + json_object_set(json, "timestamp", json_new_number(tv.tv_sec)); *ret_json = json; } else { json_value_free(error_list); |