parent
4c25a12232
commit
568ee2489f
10
configure.ac
10
configure.ac
|
@ -64,6 +64,16 @@ AM_LANGINFO_CODESET
|
||||||
AM_GNU_GETTEXT([external])
|
AM_GNU_GETTEXT([external])
|
||||||
AM_GNU_GETTEXT_VERSION([0.16.1])
|
AM_GNU_GETTEXT_VERSION([0.16.1])
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes],
|
||||||
|
[AC_CHECK_LIB([rt], [clock_gettime], [have_clock_gettime=-lrt],
|
||||||
|
[have_clock_gettime=no])])
|
||||||
|
if test "x$have_clock_gettime" != xno; then
|
||||||
|
AC_DEFINE(USE_MONOTONIC_CLOCK, 1, [Use monotonic clock from clock_gettime()])
|
||||||
|
if test "x$have_clock_gettime" != xyes; then
|
||||||
|
AC_SUBST(CLOCK_LIBS, [$have_clock_gettime])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
AC_ARG_ENABLE(hints-gnome,
|
AC_ARG_ENABLE(hints-gnome,
|
||||||
[ --enable-hints-gnome compile with GNOME(<2.0) hints support @<:@default=no@:>@],,
|
[ --enable-hints-gnome compile with GNOME(<2.0) hints support @<:@default=no@:>@],,
|
||||||
enable_hints_gnome=no)
|
enable_hints_gnome=no)
|
||||||
|
|
|
@ -151,6 +151,7 @@ LDADD = \
|
||||||
$(X_EXTRA_LIBS) \
|
$(X_EXTRA_LIBS) \
|
||||||
$(E_X_LIBS) \
|
$(E_X_LIBS) \
|
||||||
$(DBUS_LIBS) \
|
$(DBUS_LIBS) \
|
||||||
|
$(CLOCK_LIBS) \
|
||||||
-lX11 -lm
|
-lX11 -lm
|
||||||
|
|
||||||
if BUILD_MODULES
|
if BUILD_MODULES
|
||||||
|
|
39
src/timers.c
39
src/timers.c
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||||
* Copyright (C) 2006-2009 Kim Woelders
|
* Copyright (C) 2006-2011 Kim Woelders
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to
|
* of this software and associated documentation files (the "Software"), to
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
#include "E.h"
|
#include "E.h"
|
||||||
#include "e16-ecore_list.h"
|
#include "e16-ecore_list.h"
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#define DEBUG_TIMERS 0
|
#define DEBUG_TIMERS 0
|
||||||
|
@ -46,6 +47,42 @@ GetTime(void)
|
||||||
return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
|
return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
GetTimeMs(void)
|
||||||
|
{
|
||||||
|
#if USE_MONOTONIC_CLOCK
|
||||||
|
struct timespec ts;
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
|
||||||
|
return (unsigned int)(ts.tv_sec * 1000 + ts.tv_nsec / 1000000);
|
||||||
|
#else
|
||||||
|
struct timeval timev;
|
||||||
|
|
||||||
|
gettimeofday(&timev, NULL);
|
||||||
|
|
||||||
|
return (unsigned int)(timev.tv_sec * 1000 + timev.tv_usec / 1000);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
GetTimeUs(void)
|
||||||
|
{
|
||||||
|
#if USE_MONOTONIC_CLOCK
|
||||||
|
struct timespec ts;
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
|
||||||
|
return (unsigned int)(ts.tv_sec * 1000000 + ts.tv_nsec / 1000);
|
||||||
|
#else
|
||||||
|
struct timeval timev;
|
||||||
|
|
||||||
|
gettimeofday(&timev, NULL);
|
||||||
|
|
||||||
|
return (unsigned int)(timev.tv_sec * 1000000 + timev.tv_usec);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static Timer *q_first = NULL;
|
static Timer *q_first = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||||
* Copyright (C) 2004-2009 Kim Woelders
|
* Copyright (C) 2004-2011 Kim Woelders
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to
|
* of this software and associated documentation files (the "Software"), to
|
||||||
|
@ -26,8 +26,9 @@
|
||||||
|
|
||||||
#include "etypes.h"
|
#include "etypes.h"
|
||||||
|
|
||||||
/* timers.c */
|
|
||||||
double GetTime(void);
|
double GetTime(void);
|
||||||
|
unsigned int GetTimeMs(void);
|
||||||
|
unsigned int GetTimeUs(void);
|
||||||
|
|
||||||
Timer *TimerAdd(double in_time,
|
Timer *TimerAdd(double in_time,
|
||||||
int (*func) (void *data), void *data);
|
int (*func) (void *data), void *data);
|
||||||
|
|
Loading…
Reference in New Issue