X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Flp_json.c;h=e217180062a6ba4a20c393f054b3d574660027a4;hb=cbe5f873c5f0306a7a5d2f431992dbbb6edbe332;hp=d88587a9f3dd396711d795d120c7175a7fb7ac3d;hpb=48adae7cac47f09a5ac0ce7c3b53359b340a1110;p=ppastats.git diff --git a/src/lp_json.c b/src/lp_json.c index d88587a..e217180 100644 --- a/src/lp_json.c +++ b/src/lp_json.c @@ -64,7 +64,7 @@ static struct bpph *json_to_bpph(json_object *o) date_created = json_object_get_string (json_object_object_get(o, "date_created")); if (date_created) - strptime(date_created, "%FT%T%z", &bpph->date_created); + strptime(date_created, "%FT%T", &bpph->date_created); status = json_object_get_string(json_object_object_get(o, "status")); if (status) @@ -97,6 +97,11 @@ static json_object *bpph_to_json(struct bpph *bpph) json_object_object_add (json, + "self_link", + json_object_new_string(bpph->self_link)); + + json_object_object_add + (json, "architecture_specific", json_object_new_boolean(bpph->architecture_specific)); @@ -106,7 +111,7 @@ static json_object *bpph_to_json(struct bpph *bpph) date = malloc(strlen("YY-MM-DDThh:mm:ss+xxx") + 1); strftime(date, strlen("YY-MM-DDThh:mm:ss+xxx") + 1, - "%FT%T%z", + "%FT%T", &bpph->date_created); json_object_object_add @@ -217,8 +222,9 @@ json_object *bpph_list_to_json(struct bpph **list) entries = json_object_new_array(); json_object_object_add(result, "entries", entries); - for (cur = list; *cur; cur++) - json_object_array_add(entries, bpph_to_json(*cur)); + if (list) + for (cur = list; *cur; cur++) + json_object_array_add(entries, bpph_to_json(*cur)); return result; }