Use clock_get_time instead of gettimeofday
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 26 Sep 2013 02:13:49 +0000 (11:13 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 26 Sep 2013 02:13:49 +0000 (11:13 +0900)
Change-Id: Ic6a329613a0d7f44f61bc3382cbe22e31685f1ab

CMakeLists.txt
packaging/liblivebox-edje.spec
src/script_port.c

index ce68583..43a9465 100644 (file)
@@ -30,6 +30,7 @@ ADD_DEFINITIONS("-DPACKAGE=\"${PROJECT_NAME}\"")
 
 ADD_DEFINITIONS("${EXTRA_CFLAGS} -g -Wall -Werror")
 ADD_DEFINITIONS("-DNDEBUG")
+ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET")
 ADD_DEFINITIONS("-DLOG_TAG=\"LIVEBOX_EDJE\"")
 
 ADD_LIBRARY(${PROJECT_NAME} SHARED
index bd8034a..6889b38 100644 (file)
@@ -1,6 +1,6 @@
 Name: liblivebox-edje
 Summary: EDJE Script loader for the data provider master
-Version: 0.5.16
+Version: 0.5.17
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index 8336da2..5fbe710 100644 (file)
@@ -189,7 +189,6 @@ static void activate_cb(void *data, Evas_Object *part_obj, Elm_Object_Item *item
        int y;
        int w;
        int h;
-       struct timeval tv;
        double timestamp;
 
        ao = evas_object_data_get(part_obj, "ao");
@@ -207,12 +206,17 @@ static void activate_cb(void *data, Evas_Object *part_obj, Elm_Object_Item *item
        x += w / 2;
        y += h / 2;
 
+#if defined(_USE_ECORE_TIME_GET)
+       timestamp = ecore_time_get();
+#else
+       struct timeval tv;
        if (gettimeofday(&tv, NULL) < 0) {
                ErrPrint("Failed to get time\n");
                timestamp = 0.0f;
        } else {
                timestamp = (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0f);
        }
+#endif
 
        DbgPrint("Cursor is on %dx%d\n", x, y);
        evas_event_feed_mouse_move(e, x, y, timestamp * 1000, NULL);
@@ -1164,15 +1168,19 @@ PUBLIC int script_update_script(void *h, Evas *e, const char *src_id, const char
        if (!target_id) {
                if (find_edje(handle, part)) {
                        double timestamp;
-                       struct timeval tv;
 
                        do {
+#if defined(_USE_ECORE_TIME_GET)
+                               timestamp = ecore_time_get();
+#else
+                               struct timeval tv;
                                if (gettimeofday(&tv, NULL) < 0) {
                                        static int local_idx = 0;
                                        timestamp = (double)(local_idx++);
                                } else {
                                        timestamp = (double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0f);
                                }
+#endif
 
                                snprintf(_target_id, sizeof(_target_id), "%lf", timestamp);
                        } while (find_edje(handle, _target_id));