]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbstatus: add machine readable creation_time to notify
authorJule Anger <janger@samba.org>
Mon, 1 Aug 2022 09:04:23 +0000 (11:04 +0200)
committerJule Anger <janger@samba.org>
Mon, 8 Aug 2022 12:56:29 +0000 (12:56 +0000)
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/utils/status_json.c

index b57b690e552de8dfeb877d0238724dd086ab8bec..b3c9d66d0fe4d229ea61e6830a79b8856626d35d 100644 (file)
@@ -1119,6 +1119,9 @@ bool print_notify_rec_json(struct traverse_state *state,
        struct json_object notify_json;
        char *filter = NULL;
        char *subdir_filter = NULL;
+       struct timeval_buf tv_buf;
+       struct timeval val;
+       char *time = NULL;
        char *pid = NULL;
        struct server_id_buf tmp;
        int result = 0;
@@ -1161,6 +1164,12 @@ bool print_notify_rec_json(struct traverse_state *state,
        if (result < 0) {
                goto failure;
        }
+       val = convert_timespec_to_timeval(instance->creation_time);
+       time = timeval_str_buf(&val, true, true, &tv_buf);
+       result = json_add_string(&sub_json, "creation_time", time);
+       if (result < 0) {
+               goto failure;
+       }
 
        pid = server_id_str_buf(server_id, &tmp);
        result = json_add_object(&notify_json, pid, &sub_json);