From cf672a865428b5e55844b6d2e01ca9d3bd4afe6b Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 18 Jan 2017 01:30:43 +0100 Subject: [PATCH] *: use monotime() This is largely a bulk-replace made with coccinelle. Signed-off-by: David Lamparter --- bgpd/bgpd.c | 2 +- isisd/isis_spf.c | 4 ++-- lib/bfd.c | 2 +- lib/thread.c | 24 ------------------------ lib/thread.h | 8 +------- ospf6d/ospf6_abr.c | 2 +- ospf6d/ospf6_bfd.c | 2 +- ospf6d/ospf6_flood.c | 6 +++--- ospf6d/ospf6_interface.c | 2 +- ospf6d/ospf6_intra.c | 4 ++-- ospf6d/ospf6_lsa.c | 6 +++--- ospf6d/ospf6_message.c | 2 +- ospf6d/ospf6_neighbor.c | 8 ++++---- ospf6d/ospf6_route.c | 6 +++--- ospf6d/ospf6_spf.c | 4 ++-- ospf6d/ospf6_top.c | 4 ++-- ospfd/ospf_ase.c | 4 ++-- ospfd/ospf_bfd.c | 2 +- ospfd/ospf_lsa.c | 8 ++++---- ospfd/ospf_packet.c | 2 +- ospfd/ospf_spf.c | 22 +++++++++++----------- ospfd/ospfd.c | 6 +++--- tests/test-timer-performance.c | 6 +++--- zebra/zebra_fpm.c | 6 +++--- zebra/zebra_rnh.c | 2 +- zebra/zserv.c | 14 +++++++------- 26 files changed, 64 insertions(+), 94 deletions(-) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 5457822f3b..3cd1ac65c0 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -348,7 +348,7 @@ time_t bgp_clock (void) { struct timeval tv; - quagga_gettime(QUAGGA_CLK_MONOTONIC, &tv); + monotime(&tv); return tv.tv_sec; } diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 086f5b23da..c1fb062e55 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -1149,7 +1149,7 @@ isis_run_spf (struct isis_area *area, int level, int family, u_char *sysid) unsigned long long start_time, end_time; /* Get time that can't roll backwards. */ - quagga_gettime(QUAGGA_CLK_MONOTONIC, &time_now); + monotime(&time_now); start_time = time_now.tv_sec; start_time = (start_time * 1000000) + time_now.tv_usec; @@ -1243,7 +1243,7 @@ out: spftree->pending = 0; spftree->runcount++; spftree->last_run_timestamp = time (NULL); - quagga_gettime(QUAGGA_CLK_MONOTONIC, &time_now); + monotime(&time_now); end_time = time_now.tv_sec; end_time = (end_time * 1000000) + time_now.tv_usec; spftree->last_run_duration = end_time - start_time; diff --git a/lib/bfd.c b/lib/bfd.c index 5db08fea60..a5edaea217 100644 --- a/lib/bfd.c +++ b/lib/bfd.c @@ -362,7 +362,7 @@ bfd_last_update (time_t last_update, char *buf, size_t len) } /* Get current time. */ - quagga_gettime(QUAGGA_CLK_MONOTONIC, &tv); + monotime(&tv); curr = tv.tv_sec; diff = curr - last_update; tm = gmtime (&diff); diff --git a/lib/thread.c b/lib/thread.c index acec80a636..cb7676f0e2 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -93,30 +93,6 @@ quagga_get_relative (struct timeval *tv) return ret; } -/* Exported Quagga timestamp function. - * Modelled on POSIX clock_gettime. - */ -int -quagga_gettime (enum quagga_clkid clkid, struct timeval *tv) -{ - switch (clkid) - { - case QUAGGA_CLK_MONOTONIC: - return quagga_get_relative (tv); - default: - errno = EINVAL; - return -1; - } -} - -time_t -quagga_monotime (void) -{ - struct timeval tv; - quagga_get_relative(&tv); - return tv.tv_sec; -} - static unsigned int cpu_record_hash_key (struct cpu_thread_history *a) { diff --git a/lib/thread.h b/lib/thread.h index a28768e50b..348e4e155a 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -23,6 +23,7 @@ #define _ZEBRA_THREAD_H #include +#include "monotime.h" struct rusage_t { @@ -247,13 +248,6 @@ extern void thread_set_yield_time (struct thread *, unsigned long); extern void thread_getrusage (RUSAGE_T *); extern void thread_cmd_init (void); -/* replacements for the system gettimeofday(), clock_gettime() and - * time() functions, providing support for non-decrementing clock on - * all systems, and fully monotonic on /some/ systems. - */ -extern int quagga_gettime (enum quagga_clkid, struct timeval *); -extern time_t quagga_monotime (void); - /* Returns elapsed real (wall clock) time. */ extern unsigned long thread_consumed_time(RUSAGE_T *after, RUSAGE_T *before, unsigned long *cpu_time_elapsed); diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c index f75a35fa50..2e31535d24 100644 --- a/ospf6d/ospf6_abr.c +++ b/ospf6d/ospf6_abr.c @@ -433,7 +433,7 @@ ospf6_abr_originate_summary_to_area (struct ospf6_route *route, else { summary->type = route->type; - quagga_gettime (QUAGGA_CLK_MONOTONIC, &summary->changed); + monotime(&summary->changed); } summary->path.router_bits = route->path.router_bits; diff --git a/ospf6d/ospf6_bfd.c b/ospf6d/ospf6_bfd.c index 28126918b5..fed5021208 100644 --- a/ospf6d/ospf6_bfd.c +++ b/ospf6d/ospf6_bfd.c @@ -245,7 +245,7 @@ ospf6_bfd_interface_dest_update (int command, struct zclient *zclient, old_status = bfd_info->status; bfd_info->status = status; - quagga_gettime (QUAGGA_CLK_MONOTONIC, &tv); + monotime(&tv); bfd_info->last_update = tv.tv_sec; if ((status == BFD_STATUS_DOWN) && (old_status == BFD_STATUS_UP)) diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index 14c16c0241..6ac93d8984 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -224,7 +224,7 @@ ospf6_install_lsa (struct ospf6_lsa *lsa) ospf6_flood_clear (old); } - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); if (! OSPF6_LSA_IS_MAXAGE (lsa)) lsa->expire = thread_add_timer (master, ospf6_lsa_expire, lsa, OSPF_LSA_MAXAGE + lsa->birth.tv_sec - now.tv_sec); @@ -862,7 +862,7 @@ ospf6_receive_lsa (struct ospf6_neighbor *from, if (old) { struct timeval now, res; - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); timersub (&now, &old->installed, &res); time_delta_ms = (res.tv_sec * 1000) + (int)(res.tv_usec/1000); if (time_delta_ms < from->ospf6_if->area->ospf6->lsa_minarrival) @@ -875,7 +875,7 @@ ospf6_receive_lsa (struct ospf6_neighbor *from, } } - quagga_gettime (QUAGGA_CLK_MONOTONIC, &new->received); + monotime(&new->received); if (is_debug) zlog_debug ("Install, Flood, Possibly acknowledge the received LSA"); diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 0ed8d30a8b..c458098099 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -961,7 +961,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); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); timerclear (&res); if (oi->thread_send_lsupdate) diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c index 586bd77f75..d93406fb68 100644 --- a/ospf6d/ospf6_intra.c +++ b/ospf6d/ospf6_intra.c @@ -1485,11 +1485,11 @@ ospf6_brouter_debug_print (struct ospf6_route *brouter) ospf6_linkstate_prefix2str (&brouter->prefix, destination, sizeof (destination)); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); timersub (&now, &brouter->installed, &res); timerstring (&res, installed, sizeof (installed)); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); timersub (&now, &brouter->changed, &res); timerstring (&res, changed, sizeof (changed)); diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 92ee9662b7..bea153c928 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -207,7 +207,7 @@ ospf6_lsa_age_set (struct ospf6_lsa *lsa) assert (lsa && lsa->header); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); lsa->birth.tv_sec = now.tv_sec - ntohs (lsa->header->age); lsa->birth.tv_usec = now.tv_usec; @@ -228,7 +228,7 @@ ospf6_lsa_age_current (struct ospf6_lsa *lsa) assert (lsa->header); /* current time */ - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); if (ntohs (lsa->header->age) >= OSPF_LSA_MAXAGE) { @@ -509,7 +509,7 @@ ospf6_lsa_show (struct vty *vty, struct ospf6_lsa *lsa) inet_ntop (AF_INET, &lsa->header->adv_router, adv_router, sizeof (adv_router)); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); timersub (&now, &lsa->installed, &res); timerstring (&res, duration, sizeof (duration)); diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index 229c1ef557..578b39a641 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -1817,7 +1817,7 @@ ospf6_dbdesc_send (struct thread *thread) if (CHECK_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT) && (on->dbdesc_seqnum == 0)) { - on->dbdesc_seqnum = quagga_monotime (); + on->dbdesc_seqnum = monotime(NULL); } dbdesc->options[0] = on->ospf6_if->area->options[0]; diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index f8a0d7a317..ec79a1552b 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -97,7 +97,7 @@ ospf6_neighbor_create (u_int32_t router_id, struct ospf6_interface *oi) on->ospf6_if = oi; on->state = OSPF6_NEIGHBOR_DOWN; on->state_change = 0; - quagga_gettime (QUAGGA_CLK_MONOTONIC, &on->last_changed); + monotime(&on->last_changed); on->router_id = router_id; on->summary_list = ospf6_lsdb_create (on); @@ -163,7 +163,7 @@ ospf6_neighbor_state_change (u_char next_state, struct ospf6_neighbor *on, int e return; on->state_change++; - quagga_gettime (QUAGGA_CLK_MONOTONIC, &on->last_changed); + monotime(&on->last_changed); /* log */ if (IS_OSPF6_DEBUG_NEIGHBOR (STATE)) @@ -705,7 +705,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)); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); timersub (&now, &on->last_changed, &res); timerstring (&res, duration, sizeof (duration)); @@ -729,7 +729,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)); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&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 2f416e2689..29956c61a0 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -600,7 +600,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); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); node = route_node_get (table->table, &route->prefix); route->rnode = node; @@ -1020,7 +1020,7 @@ ospf6_route_show (struct vty *vty, struct ospf6_route *route) struct listnode *node; struct ospf6_nexthop *nh; - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); timersub (&now, &route->changed, &res); timerstring (&res, duration, sizeof (duration)); @@ -1068,7 +1068,7 @@ ospf6_route_show_detail (struct vty *vty, struct ospf6_route *route) struct listnode *node; struct ospf6_nexthop *nh; - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); /* destination */ if (route->type == OSPF6_DEST_TYPE_LINKSTATE) diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 9014446374..333ce5588e 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -603,7 +603,7 @@ ospf6_spf_calculation_thread (struct thread *t) ospf6->t_spf_calc = NULL; /* execute SPF calculation */ - quagga_gettime (QUAGGA_CLK_MONOTONIC, &start); + monotime(&start); if (ospf6_is_router_abr (ospf6)) ospf6_abr_range_reset_cost (ospf6); @@ -644,7 +644,7 @@ ospf6_spf_calculation_thread (struct thread *t) if (ospf6_is_router_abr (ospf6)) ospf6_abr_defaults_to_stub (ospf6); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &end); + monotime(&end); timersub (&end, &start, &runtime); ospf6->ts_spf_duration = runtime; diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 6da9680fe2..92111c73fc 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -124,7 +124,7 @@ ospf6_create (void) o = XCALLOC (MTYPE_OSPF6_TOP, sizeof (struct ospf6)); /* initialize */ - quagga_gettime (QUAGGA_CLK_MONOTONIC, &o->starttime); + monotime(&o->starttime); o->area_list = list_new (); o->area_list->cmp = ospf6_area_cmp; o->lsdb = ospf6_lsdb_create (o); @@ -891,7 +891,7 @@ ospf6_show (struct vty *vty, struct ospf6 *o) router_id, VNL); /* running time */ - quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); + monotime(&now); timersub (&now, &o->starttime, &running); timerstring (&running, duration, sizeof (duration)); vty_out (vty, " Running %s%s", duration, VNL); diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c index fe40b10171..b063f317e2 100644 --- a/ospfd/ospf_ase.c +++ b/ospfd/ospf_ase.c @@ -649,7 +649,7 @@ ospf_ase_calculate_timer (struct thread *t) { ospf->ase_calc = 0; - quagga_gettime(QUAGGA_CLK_MONOTONIC, &start_time); + monotime(&start_time); /* Calculate external route for each AS-external-LSA */ LSDB_LOOP (EXTERNAL_LSDB (ospf), rn, lsa) @@ -681,7 +681,7 @@ ospf_ase_calculate_timer (struct thread *t) ospf->old_external_route = ospf->new_external_route; ospf->new_external_route = route_table_init (); - quagga_gettime(QUAGGA_CLK_MONOTONIC, &stop_time); + monotime(&stop_time); zlog_info ("SPF Processing Time(usecs): External Routes: %lld\n", (stop_time.tv_sec - start_time.tv_sec)*1000000LL+ diff --git a/ospfd/ospf_bfd.c b/ospfd/ospf_bfd.c index b4d50a6b9f..74bc38220b 100644 --- a/ospfd/ospf_bfd.c +++ b/ospfd/ospf_bfd.c @@ -249,7 +249,7 @@ ospf_bfd_interface_dest_update (int command, struct zclient *zclient, old_status = bfd_info->status; bfd_info->status = status; - quagga_gettime (QUAGGA_CLK_MONOTONIC, &tv); + monotime(&tv); bfd_info->last_update = tv.tv_sec; if ((status == BFD_STATUS_DOWN) && (old_status == BFD_STATUS_UP)) diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index d4811c5b21..cf9943893a 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -3638,8 +3638,8 @@ ospf_refresher_register_lsa (struct ospf *ospf, struct ospf_lsa *lsa) */ delay = (random() % (max_delay - min_delay)) + min_delay; - current_index = ospf->lsa_refresh_queue.index + (quagga_monotime () - - ospf->lsa_refresher_started)/OSPF_LSA_REFRESHER_GRANULARITY; + current_index = ospf->lsa_refresh_queue.index + (monotime(NULL) + - ospf->lsa_refresher_started)/OSPF_LSA_REFRESHER_GRANULARITY; index = (current_index + delay/OSPF_LSA_REFRESHER_GRANULARITY) % (OSPF_LSA_REFRESHER_SLOTS); @@ -3702,7 +3702,7 @@ ospf_lsa_refresh_walker (struct thread *t) modulus. */ ospf->lsa_refresh_queue.index = ((unsigned long)(ospf->lsa_refresh_queue.index + - (quagga_monotime () - ospf->lsa_refresher_started) + (monotime(NULL) - ospf->lsa_refresher_started) / OSPF_LSA_REFRESHER_GRANULARITY)) % OSPF_LSA_REFRESHER_SLOTS; @@ -3743,7 +3743,7 @@ ospf_lsa_refresh_walker (struct thread *t) ospf->t_lsa_refresher = thread_add_timer (master, ospf_lsa_refresh_walker, ospf, ospf->lsa_refresh_interval); - ospf->lsa_refresher_started = quagga_monotime (); + ospf->lsa_refresher_started = monotime(NULL); for (ALL_LIST_ELEMENTS (lsa_to_refresh, node, nnode, lsa)) { diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 2aa761d46f..bf78336ad5 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -3574,7 +3574,7 @@ ospf_db_desc_send (struct ospf_neighbor *nbr) if (nbr->last_send) ospf_packet_free (nbr->last_send); nbr->last_send = ospf_packet_dup (op); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &nbr->last_send_ts); + monotime(&nbr->last_send_ts); } /* Re-send Database Description. */ diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index dcbb0151fd..2b00ff3d74 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -1280,7 +1280,7 @@ ospf_spf_calculate (struct ospf_area *area, struct route_table *new_table, /* Increment SPF Calculation Counter. */ area->spf_calculation++; - quagga_gettime (QUAGGA_CLK_MONOTONIC, &area->ospf->ts_spf); + monotime(&area->ospf->ts_spf); area->ts_spf = area->ospf->ts_spf; if (IS_DEBUG_OSPF_EVENT) @@ -1312,7 +1312,7 @@ ospf_spf_calculate_timer (struct thread *thread) ospf->t_spf_calc = NULL; - quagga_gettime (QUAGGA_CLK_MONOTONIC, &spf_start_time); + monotime(&spf_start_time); /* Allocate new table tree. */ new_table = route_table_init (); new_rtrs = route_table_init (); @@ -1339,7 +1339,7 @@ ospf_spf_calculate_timer (struct thread *thread) areas_processed++; } - quagga_gettime (QUAGGA_CLK_MONOTONIC, &stop_time); + monotime(&stop_time); spf_time = timeval_elapsed (stop_time, spf_start_time); ospf_vl_shut_unapproved (ospf); @@ -1348,14 +1348,14 @@ ospf_spf_calculate_timer (struct thread *thread) ospf_ia_routing (ospf, new_table, new_rtrs); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &stop_time); + monotime(&stop_time); ia_time = timeval_elapsed (stop_time, start_time); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &start_time); + monotime(&start_time); ospf_prune_unreachable_networks (new_table); ospf_prune_unreachable_routers (new_rtrs); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &stop_time); + monotime(&stop_time); prune_time = timeval_elapsed (stop_time, start_time); /* AS-external-LSA calculation should not be performed here. */ @@ -1366,12 +1366,12 @@ ospf_spf_calculate_timer (struct thread *thread) ospf_ase_calculate_timer_add (ospf); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &start_time); + monotime(&start_time); /* Update routing table. */ ospf_route_install (ospf, new_table); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &stop_time); + monotime(&stop_time); rt_time = timeval_elapsed (stop_time, start_time); /* Update ABR/ASBR routing table */ if (ospf->old_rtrs) @@ -1384,14 +1384,14 @@ ospf_spf_calculate_timer (struct thread *thread) ospf->old_rtrs = ospf->new_rtrs; ospf->new_rtrs = new_rtrs; - quagga_gettime (QUAGGA_CLK_MONOTONIC, &start_time); + monotime(&start_time); if (IS_OSPF_ABR (ospf)) ospf_abr_task (ospf); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &stop_time); + monotime(&stop_time); abr_time = timeval_elapsed (stop_time, start_time); - quagga_gettime (QUAGGA_CLK_MONOTONIC, &stop_time); + monotime(&stop_time); total_spf_time = timeval_elapsed (stop_time, spf_start_time); ospf->ts_spf_duration.tv_sec = total_spf_time/1000000; ospf->ts_spf_duration.tv_usec = total_spf_time % 1000000; diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index b7542c2a8b..0398bc21b8 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -273,7 +273,7 @@ ospf_new (u_short instance) new->lsa_refresh_interval = OSPF_LSA_REFRESH_INTERVAL_DEFAULT; new->t_lsa_refresher = thread_add_timer (master, ospf_lsa_refresh_walker, new, new->lsa_refresh_interval); - new->lsa_refresher_started = quagga_monotime (); + new->lsa_refresher_started = monotime(NULL); if ((new->fd = ospf_sock_init()) < 0) { @@ -1583,7 +1583,7 @@ ospf_timers_refresh_set (struct ospf *ospf, int interval) return 1; time_left = ospf->lsa_refresh_interval - - (quagga_monotime () - ospf->lsa_refresher_started); + (monotime(NULL) - ospf->lsa_refresher_started); if (time_left > interval) { @@ -1602,7 +1602,7 @@ ospf_timers_refresh_unset (struct ospf *ospf) int time_left; time_left = ospf->lsa_refresh_interval - - (quagga_monotime () - ospf->lsa_refresher_started); + (monotime(NULL) - ospf->lsa_refresher_started); if (time_left > OSPF_LSA_REFRESH_INTERVAL_DEFAULT) { diff --git a/tests/test-timer-performance.c b/tests/test-timer-performance.c index ee45ede6ac..a7d09beecc 100644 --- a/tests/test-timer-performance.c +++ b/tests/test-timer-performance.c @@ -61,7 +61,7 @@ int main(int argc, char **argv) for (i = 0; i < SCHEDULE_TIMERS; i++) thread_cancel(timers[i]); - quagga_gettime(QUAGGA_CLK_MONOTONIC, &tv_start); + monotime(&tv_start); for (i = 0; i < SCHEDULE_TIMERS; i++) { @@ -72,7 +72,7 @@ int main(int argc, char **argv) NULL, interval_msec); } - quagga_gettime(QUAGGA_CLK_MONOTONIC, &tv_lap); + monotime(&tv_lap); for (i = 0; i < REMOVE_TIMERS; i++) { @@ -84,7 +84,7 @@ int main(int argc, char **argv) timers[index] = NULL; } - quagga_gettime(QUAGGA_CLK_MONOTONIC, &tv_stop); + monotime(&tv_stop); t_schedule = 1000 * (tv_lap.tv_sec - tv_start.tv_sec); t_schedule += (tv_lap.tv_usec - tv_start.tv_usec) / 1000; diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index d44c75383b..1b2ae29eaa 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -306,7 +306,7 @@ zfpm_get_elapsed_time (time_t reference) { time_t now; - now = quagga_monotime (); + now = monotime(NULL); if (now < reference) { @@ -1163,7 +1163,7 @@ zfpm_connect_cb (struct thread *t) */ zfpm_g->connect_calls++; zfpm_g->stats.connect_calls++; - zfpm_g->last_connect_call_time = quagga_monotime (); + zfpm_g->last_connect_call_time = monotime(NULL); ret = connect (sock, (struct sockaddr *) &serv, sizeof (serv)); if (ret >= 0) @@ -1517,7 +1517,7 @@ zfpm_clear_stats (struct vty *vty) zfpm_stop_stats_timer (); zfpm_start_stats_timer (); - zfpm_g->last_stats_clear_time = quagga_monotime(); + zfpm_g->last_stats_clear_time = monotime(NULL); vty_out (vty, "Cleared FPM stats%s", VTY_NEWLINE); } diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index 315d4832dd..182cfe552d 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -922,7 +922,7 @@ send_client (struct rnh *rnh, struct zserv *client, rnh_type_t type, vrf_id_t vr } stream_putw_at (s, 0, stream_get_endp (s)); - client->nh_last_upd_time = quagga_monotime(); + client->nh_last_upd_time = monotime(NULL); client->last_write_cmd = cmd; return zebra_server_send_message(client); } diff --git a/zebra/zserv.c b/zebra/zserv.c index 6a15b9a251..dbf4262bd8 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -100,7 +100,7 @@ zserv_flush_data(struct thread *thread) break; } - client->last_write_time = quagga_monotime(); + client->last_write_time = monotime(NULL); return 0; } @@ -134,7 +134,7 @@ zebra_server_send_message(struct zserv *client) break; } - client->last_write_time = quagga_monotime(); + client->last_write_time = monotime(NULL); return 0; } @@ -826,7 +826,7 @@ zserv_rnh_register (struct zserv *client, int sock, u_short length, s = client->ibuf; - client->nh_reg_time = quagga_monotime(); + client->nh_reg_time = monotime(NULL); while (l < length) { @@ -914,7 +914,7 @@ zserv_rnh_unregister (struct zserv *client, int sock, u_short length, rnh = zebra_lookup_rnh(&p, zvrf_id (zvrf), type); if (rnh) { - client->nh_dereg_time = quagga_monotime(); + client->nh_dereg_time = monotime(NULL); zebra_remove_rnh_client(rnh, client, type); } } @@ -1826,7 +1826,7 @@ zebra_client_create (int sock) /* Set table number. */ client->rtm_table = zebrad.rtm_table_default; - client->connect_time = quagga_monotime(); + client->connect_time = monotime(NULL); /* Initialize flags */ for (afi = AFI_IP; afi < AFI_MAX; afi++) for (i = 0; i < ZEBRA_ROUTE_MAX; i++) @@ -1952,7 +1952,7 @@ zebra_client_read (struct thread *thread) zlog_debug ("zebra message received [%s] %d in VRF %u", zserv_command_string (command), length, vrf_id); - client->last_read_time = quagga_monotime(); + client->last_read_time = monotime(NULL); client->last_read_cmd = command; zvrf = zebra_vrf_lookup_by_id (vrf_id); @@ -2263,7 +2263,7 @@ zserv_time_buf(time_t *time1, char *buf, int buflen) return (buf); } - now = quagga_monotime(); + now = monotime(NULL); now -= *time1; tm = gmtime(&now); -- 2.39.5