[Openais] [PATCH]: openais/trunk: Use corosync timer_time_get api call in TMR service
Ryan O'Hara
rohara at redhat.com
Fri Feb 13 16:08:00 PST 2009
This patch makes use of the new corosync api call, timer_time_get.
-------------- next part --------------
Index: services/tmr.c
===================================================================
--- services/tmr.c (revision 1699)
+++ services/tmr.c (working copy)
@@ -47,6 +47,8 @@
#include <time.h>
#include <arpa/inet.h>
+#include <inttypes.h>
+
#include <corosync/ipc_gen.h>
#include <corosync/mar_gen.h>
#include <corosync/swab.h>
@@ -279,21 +281,6 @@
return (0);
}
-SaTimeT tmr_time_now (void)
-{
- struct timeval tv;
- SaTimeT time;
-
- if (gettimeofday (&tv, 0)) {
- return (0ULL);
- }
-
- time = (SaTimeT)(tv.tv_sec) * 1000000000ULL;
- time += (SaTimeT)(tv.tv_usec) * 1000ULL;
-
- return (time);
-}
-
static void tmr_timer_expired (void *data)
{
struct timer_instance *timer_instance = (struct timer_instance *)data;
@@ -426,7 +413,7 @@
res_lib_tmr_timerstart.header.error = error;
res_lib_tmr_timerstart.timer_id = timer_id;
- res_lib_tmr_timerstart.call_time = tmr_time_now (); /* FIXME */
+ res_lib_tmr_timerstart.call_time = (SaTimeT)(api->timer_time_get());
api->ipc_conn_send_response (conn,
&res_lib_tmr_timerstart,
@@ -651,10 +638,7 @@
/* DEBUG */
log_printf (LOG_LEVEL_NOTICE, "LIB request: saTmrTimeGet\n");
- /*
- * Use api->timer_time_get();
- */
- current_time = tmr_time_now();
+ current_time = (SaTimeT)(api->timer_time_get());
memcpy (&res_lib_tmr_timeget.current_time,
¤t_time, sizeof (SaTimeT));
More information about the Openais
mailing list