X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=trp%2Ftrp_route_encoders.c;h=c954a81353048867fa95d3cf09873abe9e5bad5b;hb=536646258cdf77d28015493c460022e6a239b4f3;hp=8e1809b12dc42c567dca748e5113bcccd32e516c;hpb=f1c739d16232445c20889ebdab9058afd7ef3d6d;p=trust_router.git diff --git a/trp/trp_route_encoders.c b/trp/trp_route_encoders.c index 8e1809b..c954a81 100644 --- a/trp/trp_route_encoders.c +++ b/trp/trp_route_encoders.c @@ -84,12 +84,15 @@ char *trp_route_to_str(TALLOC_CTX *mem_ctx, TRP_ROUTE *entry, const char *sep) /* helper */ static json_t *expiry_to_json_string(TRP_ROUTE *route) { - struct timespec ts_zero = {0, 0}; + struct timespec ts = {0}; /* initialization to zero is important */ char *s = NULL; json_t *jstr = NULL; - if (tr_cmp_timespec(trp_route_get_expiry(route), &ts_zero) > 0) { - s = timespec_to_str(trp_route_get_expiry(route)); + if (tr_cmp_timespec(trp_route_get_expiry(route), &ts) > 0) { + if (trp_route_get_expiry_realtime(route, &ts) == NULL) + s = strdup("error"); + else + s = timespec_to_str(&ts); if (s) { jstr = json_string(s);