Use one func to print timestamp from nlmsg
Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
diff --git a/bridge/monitor.c b/bridge/monitor.c
index f00e0a6..9e1ed48 100644
--- a/bridge/monitor.c
+++ b/bridge/monitor.c
@@ -35,17 +35,6 @@
exit(-1);
}
-static int show_mark(FILE *fp, const struct nlmsghdr *n)
-{
- char *tstr;
- time_t secs = ((__u32*)NLMSG_DATA(n))[0];
- long usecs = ((__u32*)NLMSG_DATA(n))[1];
- tstr = asctime(localtime(&secs));
- tstr[strlen(tstr)-1] = 0;
- fprintf(fp, "Timestamp: %s %lu us\n", tstr, usecs);
- return 0;
-}
-
static int accept_msg(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg)
{
@@ -75,7 +64,8 @@
return print_mdb(who, n, arg);
case NLMSG_TSTAMP:
- return show_mark(fp, n);
+ print_nlmsg_timestamp(fp, n);
+ return 0;
default:
return 0;