diff options
author | Lars Heer <l.heer@gmx.de> | 2013-09-18 14:47:42 +0200 |
---|---|---|
committer | Lars Heer <l.heer@gmx.de> | 2013-09-18 14:47:42 +0200 |
commit | c49649d7324c481a2a39145b77259eb58655df22 (patch) | |
tree | 52e6c3063d0608748c67e9658defdb2ffa4cfbd7 /mcast/netcv2dvbip/misc.h | |
parent | 58aa9d6ebc3bb122067c72b21af84e51aa655ad0 (diff) | |
download | vdr-plugin-mcli-c49649d7324c481a2a39145b77259eb58655df22.tar.gz vdr-plugin-mcli-c49649d7324c481a2a39145b77259eb58655df22.tar.bz2 |
added netcv2dvbip revision 188 from https://svn.baycom.de/repos/vdr-mcli-plugin/mcast/netcv2dvbip
Diffstat (limited to 'mcast/netcv2dvbip/misc.h')
-rw-r--r-- | mcast/netcv2dvbip/misc.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/mcast/netcv2dvbip/misc.h b/mcast/netcv2dvbip/misc.h new file mode 100644 index 0000000..edc269d --- /dev/null +++ b/mcast/netcv2dvbip/misc.h @@ -0,0 +1,67 @@ +#ifndef __MISC_H +#define __MISC_H + +#ifdef _MSC_VER + typedef unsigned __int64 uint64_t; // Define it from MSVC's internal type +#else + #include <stdint.h> // Use the C99 official header +#endif + +#define bool int + +#ifndef __STL_CONFIG_H // in case some plugin needs to use the STL +template<class T> inline T xmin(T a, T b) { return a <= b ? a : b; } +template<class T> inline T xmax(T a, T b) { return a >= b ? a : b; } +template<class T> inline int xsgn(T a) { return a < 0 ? -1 : a > 0 ? 1 : 0; } +template<class T> inline void xswap(T &a, T &b) { T t = a; a = b; b = t; } +#endif + +#ifdef WIN32 +typedef unsigned long in_addr_t; +#define SCKT SOCKET +#else +#include <arpa/inet.h> +#define SCKT int +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifdef WIN32 +#define strdup _strdup +#endif + +#define HI_BYTE(byte) (((byte) >> 4) & 0x0F) +#define LO_BYTE(byte) ((byte) & 0x0F) + +extern void log_socket_error(const char* msg); +extern bool GetAbsTime(struct timespec *Abstime, int MillisecondsFromNow); + +#ifdef WIN32 +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of DST correction */ +}; +extern int gettimeofday(struct timeval * tp, struct timezone * tzp); +bool IsUserAdmin( bool* pbAdmin ); +bool IsVistaOrHigher(); +#else +#include <sys/time.h> +#endif + +class cTimeMs { +private: + uint64_t begin; +public: + cTimeMs(int Ms = 0); + ///< Creates a timer with ms resolution and an initial timeout of Ms. + static uint64_t Now(void); + void Set(int Ms = 0); + bool TimedOut(void); + uint64_t Elapsed(void); +}; + +extern int quiet; + +#endif |