2007-09-30 08:24:51 -07:00
|
|
|
/*
|
|
|
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
|
|
*/
|
|
|
|
|
2007-08-26 04:17:21 -07:00
|
|
|
#ifdef _WIN32
|
2007-09-30 08:24:51 -07:00
|
|
|
# define WIN32_LEAN_AND_MEAN
|
2007-08-26 04:17:21 -07:00
|
|
|
# include <windows.h>
|
2007-09-30 08:24:51 -07:00
|
|
|
# undef WIN32_LEAN_AND_MEAN
|
2004-10-20 10:51:29 -07:00
|
|
|
#else
|
2007-08-26 04:17:21 -07:00
|
|
|
# include <sys/time.h>
|
2004-10-20 10:51:29 -07:00
|
|
|
#endif
|
2007-08-26 05:57:11 -07:00
|
|
|
#include "ecore_private.h"
|
2007-08-26 04:17:21 -07:00
|
|
|
#include "Ecore.h"
|
2004-10-20 10:51:29 -07:00
|
|
|
|
2007-09-17 16:13:59 -07:00
|
|
|
/* FIXME: clock_gettime() is an option... */
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
/**
|
2004-09-22 21:58:16 -07:00
|
|
|
* Retrieves the current system time as a floating point value in seconds.
|
|
|
|
* @return The number of seconds since 12.00AM 1st January 1970.
|
|
|
|
* @ingroup Ecore_Time_Group
|
2003-09-23 01:09:32 -07:00
|
|
|
*/
|
2006-01-06 09:58:12 -08:00
|
|
|
EAPI double
|
2003-09-23 01:09:32 -07:00
|
|
|
ecore_time_get(void)
|
|
|
|
{
|
2007-08-26 04:17:21 -07:00
|
|
|
#ifdef _WIN32
|
2007-10-27 03:24:52 -07:00
|
|
|
FILETIME ft;
|
2007-08-27 03:20:12 -07:00
|
|
|
double time;
|
|
|
|
|
2007-10-27 03:24:52 -07:00
|
|
|
GetSystemTimeAsFileTime(&ft);
|
|
|
|
time = (double)ft.dwLowDateTime + 4294967296.0 * (double)ft.dwHighDateTime;
|
2007-08-27 03:20:12 -07:00
|
|
|
|
2007-10-27 03:24:52 -07:00
|
|
|
return time / 10000000;
|
2007-08-26 04:17:21 -07:00
|
|
|
#else
|
|
|
|
# ifdef HAVE_GETTIMEOFDAY
|
2003-09-23 01:09:32 -07:00
|
|
|
struct timeval timev;
|
|
|
|
|
|
|
|
gettimeofday(&timev, NULL);
|
|
|
|
return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
|
2007-08-26 04:17:21 -07:00
|
|
|
# else
|
|
|
|
# error "Your platform isn't supported yet"
|
|
|
|
# endif
|
|
|
|
#endif /* _WIN32 */
|
2003-09-23 01:09:32 -07:00
|
|
|
}
|