From 86f72dcba35f055b5344deeb5f057c2f1d9a291f Mon Sep 17 00:00:00 2001 From: Takashi Sogabe Date: Mon, 22 Jun 2009 13:07:02 +0900 Subject: Convert ospf6d over to quagga_gettime() wrappers. --- ospf6d/ospf6_abr.c | 2 +- ospf6d/ospf6_flood.c | 6 +++--- ospf6d/ospf6_interface.c | 2 +- ospf6d/ospf6_intra.c | 4 ++-- ospf6d/ospf6_lsa.c | 10 +++++----- ospf6d/ospf6_message.c | 2 +- ospf6d/ospf6_neighbor.c | 10 +++++----- ospf6d/ospf6_route.c | 6 +++--- ospf6d/ospf6_spf.c | 4 ++-- ospf6d/ospf6_top.c | 4 ++-- 10 files changed, 25 insertions(+), 25 deletions(-) (limited to 'ospf6d') diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index 8224b109..d38ef21a 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -402,7 +402,7 @@ ospf6_abr_originate_summary_to_area (struct ospf6_route *route, 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 8c460293..670c5d1d 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -225,7 +225,7 @@ ospf6_install_lsa (struct ospf6_lsa *lsa) 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 @@ ospf6_receive_lsa (struct ospf6_neighbor *from, 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 @@ ospf6_receive_lsa (struct ospf6_neighbor *from, } } - 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 5a79862f..2cd5303f 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -825,7 +825,7 @@ ospf6_interface_show (struct vty *vty, struct interface *ifp) 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 103e8fc2..05b11ba3 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -1256,11 +1256,11 @@ ospf6_brouter_debug_print (struct ospf6_route *brouter) 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 e8290b63..108c025d 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -180,8 +180,8 @@ ospf6_lsa_age_set (struct ospf6_lsa *lsa) 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 @@ ospf6_lsa_age_current (struct ospf6_lsa *lsa) 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 @@ ospf6_lsa_show_summary (struct vty *vty, struct ospf6_lsa *lsa) 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 c257092a..790fc0ae 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -1456,7 +1456,7 @@ ospf6_dbdesc_send (struct thread *thread) 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 8a5d698d..f6c3aeac 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -89,7 +89,7 @@ ospf6_neighbor_create (u_int32_t router_id, struct ospf6_interface *oi) 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 @@ ospf6_neighbor_state_change (u_char next_state, struct ospf6_neighbor *on) 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 @@ ospf6_neighbor_show (struct vty *vty, struct ospf6_neighbor *on) } #endif /*HAVE_GETNAMEINFO*/ - gettimeofday (&now, NULL); + quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); /* Dead time */ h = m = s = 0; @@ -630,7 +630,7 @@ ospf6_neighbor_show_drchoice (struct vty *vty, struct ospf6_neighbor *on) 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 @@ ospf6_neighbor_show_detail (struct vty *vty, struct ospf6_neighbor *on) 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 a89ed7e7..9832f570 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -378,7 +378,7 @@ ospf6_route_add (struct ospf6_route *route, 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 @@ ospf6_route_show (struct vty *vty, struct ospf6_route *route) 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 @@ ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route) 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 44e11f9d..bfb6df2e 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -527,9 +527,9 @@ ospf6_spf_calculation_thread (struct thread *t) 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 b42962c5..c4cc9fac 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -117,7 +117,7 @@ ospf6_create (void) 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 @@ ospf6_show (struct vty *vty, struct ospf6 *o) 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); -- cgit v1.2.1