On 09/28/2012 11:10 AM, Enlightenment SVN wrote:
> Log:
> eeze/sensor: Fix fake module to set timestamp to microseconds since epoch.
>
>    Seconds is not really a suitable resolution for sensor data read outs. This
>    also aligns it with the tizen module and the public API.
>    The sleep is no longer needed in the test program either.

Use ecore_time_unix_get() (Or better ecore_loop_time_get() or 
ecore_time_get() if possible)

S.

>
> Author:       stefan
> Date:         2012-09-28 02:10:47 -0700 (Fri, 28 Sep 2012)
> New Revision: 77191
> Trac:         http://trac.enlightenment.org/e/changeset/77191
>
> Modified:
>    trunk/eeze/src/bin/eeze_sensor_test.c 
> trunk/eeze/src/modules/eeze_sensor_fake.c
>
> Modified: trunk/eeze/src/bin/eeze_sensor_test.c
> ===================================================================
> --- trunk/eeze/src/bin/eeze_sensor_test.c     2012-09-28 09:10:43 UTC (rev 
> 77190)
> +++ trunk/eeze/src/bin/eeze_sensor_test.c     2012-09-28 09:10:47 UTC (rev 
> 77191)
> @@ -129,8 +129,6 @@
>      else
>        printf("Could not find a light sensor!\n");
>
> -   sleep(1);
> -
>      /* Get updated values on a sensor. Read out is synchronous */
>      eeze_sensor_read(sens);
>      if (!sens) printf("can't find an light sensor!\n");
>
> Modified: trunk/eeze/src/modules/eeze_sensor_fake.c
> ===================================================================
> --- trunk/eeze/src/modules/eeze_sensor_fake.c 2012-09-28 09:10:43 UTC (rev 
> 77190)
> +++ trunk/eeze/src/modules/eeze_sensor_fake.c 2012-09-28 09:10:47 UTC (rev 
> 77191)
> @@ -3,7 +3,7 @@
>   #endif
>
>   #include <stdio.h>
> -#include <time.h>
> +#include <sys/time.h>
>
>   #include <Eina.h>
>   #include <Ecore.h>
> @@ -38,6 +38,7 @@
>   fake_read(Eeze_Sensor_Type sensor_type, Eeze_Sensor_Obj *lobj)
>   {
>      Eeze_Sensor_Obj *obj = NULL;
> +   struct timeval tv;
>
>      obj = eeze_sensor_obj_get(sensor_type);
>      if (obj == NULL)
> @@ -56,7 +57,8 @@
>           obj->data[0] = 7;
>           obj->data[1] = 23;
>           obj->data[2] = 42;
> -        obj->timestamp = time(NULL);
> +        gettimeofday(&tv, NULL);
> +        obj->timestamp = ((tv.tv_sec * 1000000) + tv.tv_usec);
>           break;
>
>         case EEZE_SENSOR_TYPE_LIGHT:
> @@ -65,7 +67,8 @@
>         case EEZE_SENSOR_TYPE_TEMPERATURE:
>           obj->accuracy = 0;
>           obj->data[0] = 7;
> -        obj->timestamp = time(NULL);
> +        gettimeofday(&tv, NULL);
> +        obj->timestamp = ((tv.tv_sec * 1000000) + tv.tv_usec);
>           break;
>
>         default:
> @@ -82,6 +85,7 @@
>   fake_async_read(Eeze_Sensor_Type sensor_type, void *user_data EINA_UNUSED)
>   {
>      Eeze_Sensor_Obj *obj = NULL;
> +   struct timeval tv;
>
>      obj = eeze_sensor_obj_get(sensor_type);
>      if (obj == NULL)
> @@ -101,7 +105,8 @@
>           obj->data[0] = 7;
>           obj->data[1] = 23;
>           obj->data[2] = 42;
> -        obj->timestamp = time(NULL);
> +        gettimeofday(&tv, NULL);
> +        obj->timestamp = ((tv.tv_sec * 1000000) + tv.tv_usec);
>           break;
>
>         case EEZE_SENSOR_TYPE_LIGHT:
> @@ -110,7 +115,8 @@
>         case EEZE_SENSOR_TYPE_TEMPERATURE:
>           obj->accuracy = 0;
>           obj->data[0] = 7;
> -        obj->timestamp = time(NULL);
> +        gettimeofday(&tv, NULL);
> +        obj->timestamp = ((tv.tv_sec * 1000000) + tv.tv_usec);
>           break;
>
>         case EEZE_SENSOR_TYPE_MOTION_SNAP:
>
>
> ------------------------------------------------------------------------------
> Got visibility?
> Most devs has no idea what their production app looks like.
> Find out how fast your code is with AppDynamics Lite.
> http://ad.doubleclick.net/clk;262219671;13503038;y?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
> _______________________________________________
> enlightenment-svn mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>


------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to