Changeset 5574 for pjproject/trunk/pjlib/src/pj/os_timestamp_posix.c
- Timestamp:
- Mar 29, 2017 5:07:47 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/os_timestamp_posix.c
r5501 r5574 164 164 165 165 #include <errno.h> 166 #include <linux/android_alarm.h>167 #include <fcntl.h>168 166 #include <time.h> 169 167 168 #if defined(PJ_HAS_ANDROID_ALARM_H) && PJ_HAS_ANDROID_ALARM_H != 0 169 # include <linux/android_alarm.h> 170 # include <fcntl.h> 171 #endif 172 170 173 #define NSEC_PER_SEC 1000000000 171 174 175 #if defined(ANDROID_ALARM_GET_TIME) 172 176 static int s_alarm_fd = -1; 173 177 … … 178 182 s_alarm_fd = -1; 179 183 } 184 #endif 180 185 181 186 PJ_DEF(pj_status_t) pj_get_timestamp(pj_timestamp *ts) … … 184 189 int err = -1; 185 190 191 #if defined(ANDROID_ALARM_GET_TIME) 186 192 if (s_alarm_fd == -1) { 187 193 int fd = open("/dev/alarm", O_RDONLY); … … 196 202 ANDROID_ALARM_GET_TIME(ANDROID_ALARM_ELAPSED_REALTIME), &tp); 197 203 } 204 #elif defined(CLOCK_BOOTTIME) 205 err = clock_gettime(CLOCK_BOOTTIME, &tp); 206 #endif 198 207 199 208 if (err != 0) { 200 209 /* Fallback to CLOCK_MONOTONIC if /dev/alarm is not found, or 201 * getting ANDROID_ALARM_ELAPSED_REALTIME fails. 210 * getting ANDROID_ALARM_ELAPSED_REALTIME fails, or 211 * CLOCK_BOOTTIME fails. 202 212 */ 203 213 err = clock_gettime(CLOCK_MONOTONIC, &tp);
Note: See TracChangeset
for help on using the changeset viewer.