summaryrefslogtreecommitdiff
path: root/pjlib/src/pj/os_timestamp_common.c
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2011-03-16 09:22:24 +0000
committerLiong Sauw Ming <ming@teluu.com>2011-03-16 09:22:24 +0000
commit623fdccd9c92fc2a00516e5cd6ed2d5edc2272a1 (patch)
treebf30cf0db67ac5c9aa3f431efdaa7d1938656a31 /pjlib/src/pj/os_timestamp_common.c
parent2a9988f3e4c9b8d40ffebaa4427908de29324711 (diff)
Fixed #1211: Add pjlib API pj_gettickcount() that returns a monotonically increasing timestamp
* Changed the timer_heap to use pj_gettickcount(). * Changed ioqueue to use pj_gettickcount(). git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3456 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pj/os_timestamp_common.c')
-rw-r--r--pjlib/src/pj/os_timestamp_common.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/pjlib/src/pj/os_timestamp_common.c b/pjlib/src/pj/os_timestamp_common.c
index 293f6162..c7f32c69 100644
--- a/pjlib/src/pj/os_timestamp_common.c
+++ b/pjlib/src/pj/os_timestamp_common.c
@@ -188,5 +188,19 @@ PJ_DEF(pj_uint32_t) pj_elapsed_cycle( const pj_timestamp *start,
return stop->u32.lo - start->u32.lo;
}
+PJ_DEF(pj_status_t) pj_gettickcount(pj_time_val *tv)
+{
+ pj_timestamp ts, start;
+ pj_status_t status;
+
+ if ((status = pj_get_timestamp(&ts)) != PJ_SUCCESS)
+ return status;
+
+ pj_set_timestamp32(&start, 0, 0);
+ *tv = pj_elapsed_time(&start, &ts);
+
+ return PJ_SUCCESS;
+}
+
#endif /* PJ_HAS_HIGH_RES_TIMER */