Convert ospf6d over to quagga_gettime() wrappers.
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index 8224b10..d38ef21 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -402,7 +402,7 @@
else
{
summary->type = route->type;
- gettimeofday (&summary->changed, NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &summary->changed);
}
summary->path.router_bits = route->path.router_bits;
diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c
index 8c46029..670c5d1 100644
--- a/ospf6d/ospf6_flood.c
+++ b/ospf6d/ospf6_flood.c
@@ -225,7 +225,7 @@
ospf6_flood_clear (old);
}
- gettimeofday (&now, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
if (! OSPF6_LSA_IS_MAXAGE (lsa))
lsa->expire = thread_add_timer (master, ospf6_lsa_expire, lsa,
MAXAGE + lsa->birth.tv_sec - now.tv_sec);
@@ -837,7 +837,7 @@
if (old)
{
struct timeval now, res;
- gettimeofday (&now, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
timersub (&now, &old->installed, &res);
if (res.tv_sec < MIN_LS_ARRIVAL)
{
@@ -848,7 +848,7 @@
}
}
- gettimeofday (&new->received, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &new->received);
if (is_debug)
zlog_debug ("Flood, Install, Possibly acknowledge the received LSA");
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 5a79862..2cd5303 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -825,7 +825,7 @@
vty_out (vty, " Number of I/F scoped LSAs is %u%s",
oi->lsdb->count, VNL);
- gettimeofday (&now, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
timerclear (&res);
if (oi->thread_send_lsupdate)
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c
index 103e8fc..05b11ba 100644
--- a/ospf6d/ospf6_intra.c
+++ b/ospf6d/ospf6_intra.c
@@ -1256,11 +1256,11 @@
ospf6_linkstate_prefix2str (&brouter->prefix, destination,
sizeof (destination));
- gettimeofday (&now, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
timersub (&now, &brouter->installed, &res);
timerstring (&res, installed, sizeof (installed));
- gettimeofday (&now, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
timersub (&now, &brouter->changed, &res);
timerstring (&res, changed, sizeof (changed));
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index e8290b6..108c025 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -180,8 +180,8 @@
assert (lsa && lsa->header);
- if (gettimeofday (&now, (struct timezone *)NULL) < 0)
- zlog_warn ("LSA: gettimeofday failed, may fail LSA AGEs: %s",
+ if (quagga_gettime (QUAGGA_CLK_MONOTONIC, &now) < 0)
+ zlog_warn ("LSA: quagga_gettime failed, may fail LSA AGEs: %s",
safe_strerror (errno));
lsa->birth.tv_sec = now.tv_sec - ntohs (lsa->header->age);
@@ -203,8 +203,8 @@
assert (lsa->header);
/* current time */
- if (gettimeofday (&now, (struct timezone *)NULL) < 0)
- zlog_warn ("LSA: gettimeofday failed, may fail LSA AGEs: %s",
+ if (quagga_gettime (QUAGGA_CLK_MONOTONIC, &now) < 0)
+ zlog_warn ("LSA: quagga_gettime failed, may fail LSA AGEs: %s",
safe_strerror (errno));
/* calculate age */
@@ -351,7 +351,7 @@
inet_ntop (AF_INET, &lsa->header->adv_router, adv_router,
sizeof (adv_router));
- gettimeofday (&now, NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
timersub (&now, &lsa->installed, &res);
timerstring (&res, duration, sizeof (duration));
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index c257092..790fc0a 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -1456,7 +1456,7 @@
if (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT))
{
struct timeval tv;
- if (gettimeofday (&tv, (struct timezone *) NULL) < 0)
+ if (quagga_gettime (QUAGGA_CLK_MONOTONIC, &tv) < 0)
tv.tv_sec = 1;
on->dbdesc_seqnum = tv.tv_sec;
}
diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c
index 8a5d698..f6c3aea 100644
--- a/ospf6d/ospf6_neighbor.c
+++ b/ospf6d/ospf6_neighbor.c
@@ -89,7 +89,7 @@
buf, oi->interface->name);
on->ospf6_if = oi;
on->state = OSPF6_NEIGHBOR_DOWN;
- gettimeofday (&on->last_changed, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &on->last_changed);
on->router_id = router_id;
on->summary_list = ospf6_lsdb_create (on);
@@ -154,7 +154,7 @@
if (prev_state == next_state)
return;
- gettimeofday (&on->last_changed, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &on->last_changed);
/* log */
if (IS_OSPF6_DEBUG_NEIGHBOR (STATE))
@@ -568,7 +568,7 @@
}
#endif /*HAVE_GETNAMEINFO*/
- gettimeofday (&now, NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
/* Dead time */
h = m = s = 0;
@@ -630,7 +630,7 @@
inet_ntop (AF_INET, &on->drouter, drouter, sizeof (drouter));
inet_ntop (AF_INET, &on->bdrouter, bdrouter, sizeof (bdrouter));
- gettimeofday (&now, NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
timersub (&now, &on->last_changed, &res);
timerstring (&res, duration, sizeof (duration));
@@ -654,7 +654,7 @@
inet_ntop (AF_INET, &on->drouter, drouter, sizeof (drouter));
inet_ntop (AF_INET, &on->bdrouter, bdrouter, sizeof (bdrouter));
- gettimeofday (&now, NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
timersub (&now, &on->last_changed, &res);
timerstring (&res, duration, sizeof (duration));
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index a89ed7e..9832f57 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -378,7 +378,7 @@
else if (IS_OSPF6_DEBUG_ROUTE (TABLE))
zlog_debug ("%s: route add: %s", ospf6_route_table_name (table), buf);
- gettimeofday (&now, NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
node = route_node_get (table->table, &route->prefix);
route->rnode = node;
@@ -792,7 +792,7 @@
char duration[16], ifname[IFNAMSIZ];
struct timeval now, res;
- gettimeofday (&now, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
timersub (&now, &route->changed, &res);
timerstring (&res, duration, sizeof (duration));
@@ -841,7 +841,7 @@
char duration[16];
int i;
- gettimeofday (&now, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
/* destination */
if (route->type == OSPF6_DEST_TYPE_LINKSTATE)
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index 44e11f9..bfb6df2 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -527,9 +527,9 @@
ospf6_spf_log_database (oa);
/* execute SPF calculation */
- gettimeofday (&start, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &start);
ospf6_spf_calculation (oa->ospf6->router_id, oa->spf_table, oa);
- gettimeofday (&end, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &end);
timersub (&end, &start, &runtime);
if (IS_OSPF6_DEBUG_SPF (PROCESS) || IS_OSPF6_DEBUG_SPF (TIME))
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index b42962c..c4cc9fa 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -117,7 +117,7 @@
o = XCALLOC (MTYPE_OSPF6_TOP, sizeof (struct ospf6));
/* initialize */
- gettimeofday (&o->starttime, (struct timezone *) NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &o->starttime);
o->area_list = list_new ();
o->area_list->cmp = ospf6_area_cmp;
o->lsdb = ospf6_lsdb_create (o);
@@ -447,7 +447,7 @@
router_id, VNL);
/* running time */
- gettimeofday (&now, (struct timezone *)NULL);
+ quagga_gettime (QUAGGA_CLK_MONOTONIC, &now);
timersub (&now, &o->starttime, &running);
timerstring (&running, duration, sizeof (duration));
vty_out (vty, " Running %s%s", duration, VNL);