No ctime, use ctime_r.
Signed-off-by: Mark Stapp <mjs@labn.net>
struct in_addr dip;
uint16_t viewno, seq_num;
struct prefix_ipv4 p;
+ char tbuf[32];
s = stream_new(10000);
subtype = stream_getw(s);
len = stream_getl(s);
- printf("TIME: %s", ctime(&now));
+ printf("TIME: %s", ctime_r(&now, tbuf));
/* printf ("TYPE: %d/%d\n", type, subtype); */
source_as = stream_getw(s);
printf("FROM: %pI4 AS%d\n", &peer, source_as);
- printf("ORIGINATED: %s", ctime(&originated));
+ printf("ORIGINATED: %s", ctime_r(&originated,
+ tbuf));
attrlen = stream_getw(s);
printf("ATTRLEN: %d\n", attrlen);
ifindex2ifname(iter->nh->ifindex,
iter->nh->vrf_id));
tbuf = time(NULL) - (monotime(NULL) - iter->last_update);
- vty_out(vty, " Last update: %s", ctime(&tbuf));
+ vty_out(vty, " Last update: %s", ctime_r(&tbuf, buf));
if (!detail)
continue;
vty_out(vty, " Paths:\n");
struct bgp *bgp_path;
struct bgp_table *table;
time_t tbuf;
+ char buf[32];
vty_out(vty, "Current BGP mpls-vpn nexthop label bind cache, %s\n",
bgp->name_pretty);
ifindex2ifname(iter->nh->ifindex,
iter->nh->vrf_id));
tbuf = time(NULL) - (monotime(NULL) - iter->last_update);
- vty_out(vty, " Last update: %s", ctime(&tbuf));
+ vty_out(vty, " Last update: %s", ctime_r(&tbuf, buf));
if (!detail)
continue;
vty_out(vty, " Paths:\n");
{
char buf[PREFIX2STR_BUFFER];
time_t tbuf;
+ char timebuf[32];
struct peer *peer;
json_object *json_last_update = NULL;
json_object *json_nexthop = NULL;
json_last_update = json_object_new_object();
json_object_int_add(json_last_update, "epoch", tbuf);
json_object_string_add(json_last_update, "string",
- ctime(&tbuf));
+ ctime_r(&tbuf, timebuf));
json_object_object_add(json_nexthop, "lastUpdate",
json_last_update);
} else {
json_object_int_add(json_nexthop, "lastUpdate", tbuf);
}
} else {
- vty_out(vty, " Last update: %s", ctime(&tbuf));
+ vty_out(vty, " Last update: %s", ctime_r(&tbuf, timebuf));
}
/* show paths dependent on nexthop, if needed. */
char tag_buf[30];
struct attr *attr = path->attr;
time_t tbuf;
+ char timebuf[32];
json_object *json_bestpath = NULL;
json_object *json_cluster_list = NULL;
json_object *json_cluster_list_list = NULL;
json_last_update = json_object_new_object();
json_object_int_add(json_last_update, "epoch", tbuf);
json_object_string_add(json_last_update, "string",
- ctime(&tbuf));
+ ctime_r(&tbuf, timebuf));
json_object_object_add(json_path, "lastUpdate",
json_last_update);
} else
- vty_out(vty, " Last update: %s", ctime(&tbuf));
+ vty_out(vty, " Last update: %s", ctime_r(&tbuf, timebuf));
/* Line 10 display PMSI tunnel attribute, if present */
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL)) {
json_object *json_peers = NULL;
json_object *json_pkt_info = NULL;
time_t epoch_tbuf, tbuf;
+ char timebuf[32];
if (!ctx)
return CMD_SUCCESS;
json_time = json_object_new_object();
json_object_int_add(json_time, "epoch", epoch_tbuf);
json_object_string_add(json_time, "epochString",
- ctime(&epoch_tbuf));
+ ctime_r(&epoch_tbuf, timebuf));
json_object_object_add(json_updgrp, "groupCreateTime",
json_time);
json_object_string_add(json_updgrp, "afi",
json_object_int_add(json_subgrp_time, "epoch",
epoch_tbuf);
json_object_string_add(json_subgrp_time, "epochString",
- ctime(&epoch_tbuf));
+ ctime_r(&epoch_tbuf, timebuf));
json_object_object_add(json_subgrp, "groupCreateTime",
json_subgrp_time);
} else {
static inline char *timestamp_string(time_t ts)
{
time_t tbuf;
+ char timebuf[32];
+
tbuf = time(NULL) - (monotime(NULL) - ts);
- return ctime(&tbuf);
+ return ctime_r(&tbuf, timebuf);
}
static inline bool peer_established(struct peer_connection *connection)