Skip to content

Commit

Permalink
Merge pull request #14463 from mjstapp/fix_bgp_ctime_r
Browse files Browse the repository at this point in the history
bgpd: fix return of local from ctime_r
  • Loading branch information
donaldsharp authored Sep 22, 2023
2 parents 45c2d51 + 8f338b1 commit f327f2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 3 additions & 2 deletions bgpd/bgp_updgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,8 @@ static int update_group_show_walkcb(struct update_group *updgrp, void *arg)
safi2str(updgrp->safi));
} else {
vty_out(vty, "Update-group %" PRIu64 ":\n", updgrp->id);
vty_out(vty, " Created: %s", timestamp_string(updgrp->uptime));
vty_out(vty, " Created: %s",
timestamp_string(updgrp->uptime, timebuf));
}

filter = &updgrp->conf->filter[updgrp->afi][updgrp->safi];
Expand Down Expand Up @@ -803,7 +804,7 @@ static int update_group_show_walkcb(struct update_group *updgrp, void *arg)
vty_out(vty, " Update-subgroup %" PRIu64 ":\n",
subgrp->id);
vty_out(vty, " Created: %s",
timestamp_string(subgrp->uptime));
timestamp_string(subgrp->uptime, timebuf));
}

if (subgrp->split_from.update_group_id
Expand Down
3 changes: 1 addition & 2 deletions bgpd/bgpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -2595,10 +2595,9 @@ static inline int peer_group_af_configured(struct peer_group *group)
return 0;
}

static inline char *timestamp_string(time_t ts)
static inline char *timestamp_string(time_t ts, char *timebuf)
{
time_t tbuf;
char timebuf[32];

tbuf = time(NULL) - (monotime(NULL) - ts);
return ctime_r(&tbuf, timebuf);
Expand Down

0 comments on commit f327f2e

Please sign in to comment.