parent
dfe749bd81
commit
10f6a232d0
|
@ -104,6 +104,7 @@ e16_SOURCES = \
|
|||
tclass.c tclass.h \
|
||||
text.c \
|
||||
theme.c \
|
||||
time.c \
|
||||
timers.c timers.h \
|
||||
tooltips.c tooltips.h \
|
||||
user.c user.h \
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "groups.h"
|
||||
#include "settings.h"
|
||||
#include "snaps.h"
|
||||
#include "timers.h"
|
||||
|
||||
#define DEBUG_GROUPS 0
|
||||
#if DEBUG_GROUPS
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2011 Kim Woelders
|
||||
* Copyright (C) 2004-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -30,7 +30,6 @@
|
|||
#include "xwin.h"
|
||||
#include <X11/Xutil.h>
|
||||
#if USE_XSYNC
|
||||
#include "timers.h"
|
||||
#include <X11/extensions/sync.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2011 Kim Woelders
|
||||
* Copyright (C) 2004-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -24,7 +24,6 @@
|
|||
#include "E.h"
|
||||
#include "eobj.h"
|
||||
#include "xwin.h"
|
||||
#include "timers.h"
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (C) 2011-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies of the Software, its documentation and marketing & publicity
|
||||
* materials, and acknowledgment shall be given in the documentation, materials
|
||||
* and software packages that this Software was used.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include "config.h"
|
||||
#if USE_MONOTONIC_CLOCK
|
||||
#include <time.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include "util.h"
|
||||
|
||||
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
|
||||
}
|
43
src/timers.c
43
src/timers.c
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2006-2011 Kim Woelders
|
||||
* Copyright (C) 2006-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -24,11 +24,6 @@
|
|||
#include "E.h"
|
||||
#include "e16-ecore_list.h"
|
||||
#include "timers.h"
|
||||
#if USE_MONOTONIC_CLOCK
|
||||
#include <time.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#define DEBUG_TIMERS 0
|
||||
|
||||
|
@ -41,42 +36,6 @@ struct _timer {
|
|||
char again;
|
||||
};
|
||||
|
||||
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 int
|
||||
tdiff(unsigned int t1, unsigned int t2)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2011 Kim Woelders
|
||||
* Copyright (C) 2004-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -26,9 +26,6 @@
|
|||
|
||||
#include "etypes.h"
|
||||
|
||||
unsigned int GetTimeMs(void);
|
||||
unsigned int GetTimeUs(void);
|
||||
|
||||
Timer *TimerAdd(int dt_ms, int (*func) (void *data), void *data);
|
||||
void TimerDel(Timer * timer);
|
||||
void TimerSetInterval(Timer * timer, int dt_ms);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
|
||||
* Copyright (C) 2004-2008 Kim Woelders
|
||||
* Copyright (C) 2004-2012 Kim Woelders
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
|
@ -131,4 +131,7 @@ const void *ModLoadSym(const char *lib, const char *sym,
|
|||
const char *name);
|
||||
#endif
|
||||
|
||||
unsigned int GetTimeMs(void);
|
||||
unsigned int GetTimeUs(void);
|
||||
|
||||
#endif /* _UTIL_H_ */
|
||||
|
|
Loading…
Reference in New Issue