Created
May 16, 2020 16:15
-
-
Save ipcjk/9fc5f4f5a1ce0e2fc4e38efee80b2ae4 to your computer and use it in GitHub Desktop.
quagga bgpd uptime patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -upwbr quagga/bgpd/bgpd.c quagga-jk/bgpd/bgpd.c | |
--- quagga/bgpd/bgpd.c 2012-06-27 12:02:11.000000000 +0200 | |
+++ quagga-jk/bgpd/bgpd.c 2012-06-27 12:06:46.000000000 +0200 | |
@@ -4646,6 +4646,7 @@ peer_uptime (time_t uptime2, char *buf, | |
/* Making formatted timer strings. */ | |
#define ONE_DAY_SECOND 60*60*24 | |
#define ONE_WEEK_SECOND 60*60*24*7 | |
+#define ONE_YEAR_SECOND 60*60*24*7*52 | |
if (uptime1 < ONE_DAY_SECOND) | |
snprintf (buf, len, "%02d:%02d:%02d", | |
@@ -4653,6 +4654,9 @@ peer_uptime (time_t uptime2, char *buf, | |
else if (uptime1 < ONE_WEEK_SECOND) | |
snprintf (buf, len, "%dd%02dh%02dm", | |
tm->tm_yday, tm->tm_hour, tm->tm_min); | |
+ else if (uptime1 > ONE_YEAR_SECOND) | |
+ snprintf (buf, len, "%02dy%02dw%dd%02dh", | |
+ tm->tm_year-70,tm->tm_yday/7, tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour); | |
else | |
snprintf (buf, len, "%02dw%dd%02dh", | |
tm->tm_yday/7, tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment