Promotion of location.lnx.2.0-00035.

CRs      Change ID                                   Subject
--------------------------------------------------------------------------------------------------------------
1036937   I71d5cb847fc6a66227137b2b424f7e631e09cae8   Platform specific changes for QDR

Change-Id: I8400106acae6e4161b476c1c963321396a7cca05
CRs-Fixed: 1036937
This commit is contained in:
Linux Build Service Account 2016-10-26 07:03:19 -06:00
commit 22bc3b7851
5 changed files with 28 additions and 5 deletions

View file

@ -49,7 +49,7 @@ libgps_utils_so_la_LDFLAGS = -lpthread -shared -version-info 1:0:0
libgps_utils_so_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
libgps_utils_so_la_LIBADD = -lstdc++ -llog $(LOCPLA_LIBS)
libgps_utils_so_la_LIBADD = -lcutils -lstdc++ -llog $(LOCPLA_LIBS)
#Create and Install libraries
lib_LTLIBRARIES = libgps_utils_so.la

View file

@ -31,5 +31,6 @@
#include <stdint.h>
int64_t platform_lib_abstraction_elapsed_millis_since_boot();
int64_t platform_lib_abstraction_elapsed_micros_since_boot();
#endif /* __PLATFORM_LIB_TIME_H__ */

View file

@ -31,6 +31,8 @@
#include <loc_stub_time.h>
#else
#include <utils/SystemClock.h>
#include <utils/Timers.h>
#endif /* USE_GLIB */
int64_t platform_lib_abstraction_elapsed_millis_since_boot()
@ -41,7 +43,17 @@ int64_t platform_lib_abstraction_elapsed_millis_since_boot()
#else
return android::elapsedRealtime();
//return android::nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_BOOTTIME))/1000;
return nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_BOOTTIME))/1000;
#endif
}
int64_t platform_lib_abstraction_elapsed_micros_since_boot()
{
#ifdef USE_GLIB
return elapsedMicrosSinceBoot();
#else
//return android::nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_BOOTTIME));
return nanoseconds_to_microseconds(systemTime(SYSTEM_TIME_BOOTTIME));
#endif
}

View file

@ -37,6 +37,7 @@ extern "C" {
int64_t systemTime(int clock);
int64_t elapsedMillisSinceBoot();
int64_t elapsedMicrosSinceBoot();
#ifdef __cplusplus
}

View file

@ -29,6 +29,7 @@
#include "loc_stub_time.h"
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
int64_t systemTime(int clock)
{
@ -38,9 +39,17 @@ int64_t systemTime(int clock)
return t.tv_sec*1000000LL + t.tv_usec;
}
int64_t elapsedMicrosSinceBoot()
{
struct timespec ts;
int64_t time_ms = 0;
clock_gettime(CLOCK_BOOTTIME, &ts);
time_ms += (ts.tv_sec * 1000000000LL); /* Seconds to nanoseconds */
time_ms += ts.tv_nsec; /* Add Nanoseconds */
return time_ms;
}
int64_t elapsedMillisSinceBoot()
{
int64_t t_us = systemTime(0);
return (int64_t) t_us / 1000LL;
return (int64_t) (elapsedMicrosSinceBoot() /1000000LL);
}