[sr-dev] git:master:9c39af00: core: timer - relocate er_clock_gettime() in cdp module

Daniel-Constantin Mierla miconda at gmail.com
Fri May 6 09:08:09 CEST 2016


Module: kamailio
Branch: master
Commit: 9c39af00a3678aa9dd3c250181d97189d7dee883
URL: https://github.com/kamailio/kamailio/commit/9c39af00a3678aa9dd3c250181d97189d7dee883

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-05-06T09:07:11+02:00

core: timer - relocate er_clock_gettime() in cdp module

- benchmark may need it as well

---

Modified: ser_time.h
Modified: timer.c

---

Diff:  https://github.com/kamailio/kamailio/commit/9c39af00a3678aa9dd3c250181d97189d7dee883.diff
Patch: https://github.com/kamailio/kamailio/commit/9c39af00a3678aa9dd3c250181d97189d7dee883.patch

---

diff --git a/ser_time.h b/ser_time.h
index b1ecfdf..538e5af 100644
--- a/ser_time.h
+++ b/ser_time.h
@@ -37,7 +37,4 @@ time_t ser_time(time_t* t);
  * WARNING: ignores tz (it's obsolete anyway) */
 int ser_gettimeofday(struct timeval* tv, const struct timezone *tz);
 
-/* portable implementation for clock_gettime(CLOCK_REALTIME, ts) */
-int ser_clock_gettime(struct timespec *ts);
-
 #endif /* _ser_time_h */
diff --git a/timer.c b/timer.c
index c6ccea8..3a4e610 100644
--- a/timer.c
+++ b/timer.c
@@ -38,11 +38,6 @@
 #include "error.h"
 #include "signals.h"
 
-#ifdef __OS_darwin
-#include <mach/clock.h>
-#include <mach/mach.h>
-#endif
-
 /*
 #include "config.h"
 */
@@ -1159,22 +1154,4 @@ void slow_timer_main()
 
 }
 
-int ser_clock_gettime(struct timespec *ts)
-{
-#ifdef __OS_darwin
-	clock_serv_t cclock;
-	mach_timespec_t mts;
-
-	/* OS X does not have clock_gettime, use clock_get_time */
-	host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
-	clock_get_time(cclock, &mts);
-	mach_port_deallocate(mach_task_self(), cclock);
-	ts->tv_sec = mts.tv_sec;
-	ts->tv_nsec = mts.tv_nsec;
-	return 0;
-#else
-	return clock_gettime(CLOCK_REALTIME, ts);
-#endif
-}
-
 #endif




More information about the sr-dev mailing list