tm_format_time output changes by +/1 second
Ilya Evseev
ilya.evseev at gmail.com
Sun Feb 3 14:37:36 CET 2019
Hi all!
There is a problem in time output.
Consider timeformat protocol "%Y-%m-%d %H:%M:%S";
Just call "birdc show proto":
===
BIRD 1.6.5 ready.
name proto table state since info
static1 Static master up 2019-02-03 14:59:33
kernel1 Kernel master up 2019-02-03 14:59:33
device1 Device master up 2019-02-03 14:59:33
===
Then call it again:
===
BIRD 1.6.5 ready.
name proto table state since info
static1 Static master up 2019-02-03 14:59:32
kernel1 Kernel master up 2019-02-03 14:59:32
device1 Device master up 2019-02-03 14:59:32
===
As you can see, time is changed by 1 second.
That's bad for monitoring when it's configured to alert on time/state
changes.
Quick fix for me:
===
--- timer.c.orig 2019-02-03 15:06:44.388749890 +0300
+++ timer.c 2019-02-03 16:25:49.767532769 +0300
@@ -302,10 +302,9 @@
tm_format_time(char *x, struct timeformat *fmt, btime t)
{
btime dt = current_time() - t;
- btime rt = current_real_time() - dt;
int v1 = !fmt->limit || (dt < fmt->limit);
- if (!tm_format_real_time(x, TM_DATETIME_BUFFER_SIZE, v1 ? fmt->fmt1 :
fmt->fmt2, rt))
+ if (!tm_format_real_time(x, TM_DATETIME_BUFFER_SIZE, v1 ? fmt->fmt1 :
fmt->fmt2, t))
strcpy(x, "<error>");
}
===
Ilya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20190203/1362c0b9/attachment.html>
More information about the Bird-users
mailing list