ca7db2c944b7d839ef72fb9f3c14888eb6446a26
[framework/uifw/ecore.git] / src / lib / ecore / ecore_time.c
1 /*
2  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3  */
4
5 #ifdef HAVE_CONFIG_H
6 # include <config.h>
7 #endif
8
9 #ifdef HAVE_SYS_TIME_H
10 # include <sys/time.h>
11 #endif
12
13 #include "Ecore.h"
14 #include "ecore_private.h"
15
16 /* FIXME: clock_gettime() is an option... */
17
18 /**
19  * Retrieves the current system time as a floating point value in seconds.
20  * @return  The number of seconds since 12.00AM 1st January 1970.
21  * @ingroup Ecore_Time_Group
22  */
23 EAPI double
24 ecore_time_get(void)
25 {
26 #ifdef HAVE_GETTIMEOFDAY
27    struct timeval      timev;
28
29    gettimeofday(&timev, NULL);
30    return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
31 #else
32 # error "Your platform isn't supported yet"
33 #endif
34 }