diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-08-08 08:24:17 -0400 | 
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-08-08 09:06:22 -0400 | 
| commit | 99a6a31e5093159c75d950b8b6f30116a6152ac0 (patch) | |
| tree | f5f9733c85d14f76579333fd65222a324a565eb4 | |
| parent | 00857b241e6c27efad54a19b4226c37f04d80bf5 (diff) | |
*: Define the number of seconds in a Day, Week and year
The defines:
ONE_DAY_SECOND
ONE_WEEK_SECOND
ONE_YEAR_SECOND
were being defined all over the system, move the
define to a central location.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| -rw-r--r-- | bgpd/bgp_damp.c | 2 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 5 | ||||
| -rw-r--r-- | isisd/isis_misc.c | 2 | ||||
| -rw-r--r-- | lib/monotime.h | 4 | ||||
| -rw-r--r-- | ripd/rip_peer.c | 4 | ||||
| -rw-r--r-- | ripngd/ripng_peer.c | 4 | ||||
| -rw-r--r-- | zebra/zebra_vty.c | 3 | ||||
| -rw-r--r-- | zebra/zserv.c | 4 | 
8 files changed, 4 insertions, 24 deletions
diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c index bd3ae27c05..36ffb0e9c5 100644 --- a/bgpd/bgp_damp.c +++ b/bgpd/bgp_damp.c @@ -543,8 +543,6 @@ static const char *bgp_get_reuse_time(unsigned int penalty, char *buf,  		reuse_time = 0;  /* Making formatted timer strings. */ -#define ONE_DAY_SECOND 60*60*24 -#define ONE_WEEK_SECOND 60*60*24*7  	if (reuse_time == 0) {  		if (use_json)  			json_object_int_add(json, "reuseTimerMsecs", 0); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 2fa10dc6cd..d30def0f07 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -6110,11 +6110,6 @@ char *peer_uptime(time_t uptime2, char *buf, size_t len, u_char use_json,  	uptime1 -= uptime2;  	tm = gmtime(&uptime1); -/* Making formatted timer strings. */ -#define ONE_DAY_SECOND 60*60*24 -#define ONE_WEEK_SECOND ONE_DAY_SECOND*7 -#define ONE_YEAR_SECOND ONE_DAY_SECOND*365 -  	if (uptime1 < ONE_DAY_SECOND)  		snprintf(buf, len, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,  			 tm->tm_sec); diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c index c872774da8..e8888a5f5b 100644 --- a/isisd/isis_misc.c +++ b/isisd/isis_misc.c @@ -609,8 +609,6 @@ void vty_out_timestr(struct vty *vty, time_t uptime)  	difftime -= uptime;  	tm = gmtime(&difftime); -#define ONE_DAY_SECOND 60*60*24 -#define ONE_WEEK_SECOND 60*60*24*7  	if (difftime < ONE_DAY_SECOND)  		vty_out(vty, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,  			tm->tm_sec); diff --git a/lib/monotime.h b/lib/monotime.h index 7bd3386498..8e50c1874a 100644 --- a/lib/monotime.h +++ b/lib/monotime.h @@ -49,6 +49,10 @@ static inline time_t monotime(struct timeval *tvo)  	return ts.tv_sec;  } +#define ONE_DAY_SECOND 60*60*24 +#define ONE_WEEK_SECOND ONE_DAY_SECOND*7 +#define ONE_YEAR_SECOND ONE_DAY_SECOND*365 +  /* the following two return microseconds, not time_t!   *   * also, they're negative forms of each other, but having both makes the diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c index 763bfc142c..0a6337bf76 100644 --- a/ripd/rip_peer.c +++ b/ripd/rip_peer.c @@ -143,10 +143,6 @@ static char *rip_peer_uptime(struct rip_peer *peer, char *buf, size_t len)  	uptime -= peer->uptime;  	tm = gmtime(&uptime); -/* Making formatted timer strings. */ -#define ONE_DAY_SECOND 60*60*24 -#define ONE_WEEK_SECOND 60*60*24*7 -  	if (uptime < ONE_DAY_SECOND)  		snprintf(buf, len, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,  			 tm->tm_sec); diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c index 2a412f9b64..cd46d97402 100644 --- a/ripngd/ripng_peer.c +++ b/ripngd/ripng_peer.c @@ -151,10 +151,6 @@ static char *ripng_peer_uptime(struct ripng_peer *peer, char *buf, size_t len)  	uptime -= peer->uptime;  	tm = gmtime(&uptime); -/* Making formatted timer strings. */ -#define ONE_DAY_SECOND 60*60*24 -#define ONE_WEEK_SECOND 60*60*24*7 -  	if (uptime < ONE_DAY_SECOND)  		snprintf(buf, len, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,  			 tm->tm_sec); diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 13c4429d6a..c1e352faa6 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -55,9 +55,6 @@ static int do_show_ip_route(struct vty *vty, const char *vrf_name, afi_t afi,  static void vty_show_ip_route_detail(struct vty *vty, struct route_node *rn,  				     int mcast); -#define ONE_DAY_SECOND 60*60*24 -#define ONE_WEEK_SECOND 60*60*24*7 -  /* VNI range as per RFC 7432 */  #define CMD_VNI_RANGE "(1-16777215)" diff --git a/zebra/zserv.c b/zebra/zserv.c index 97f7122774..aac3d23a9e 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -2647,10 +2647,6 @@ static char *zserv_time_buf(time_t *time1, char *buf, int buflen)  	now -= *time1;  	tm = gmtime(&now); -/* Making formatted timer strings. */ -#define ONE_DAY_SECOND 60*60*24 -#define ONE_WEEK_SECOND 60*60*24*7 -  	if (now < ONE_DAY_SECOND)  		snprintf(buf, buflen, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,  			 tm->tm_sec);  | 
