cec: stick some interfaces before the pthread stuff, so we can add other implementati...
[deb_libcec.git] / src / lib / platform / windows / os_windows.h
1 #pragma once
2 /*
3 * Copyright (C) 2011 Team XBMC
4 * http://www.xbmc.org
5 *
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 * http://www.gnu.org/copyleft/gpl.html
20 *
21 */
22
23 #pragma warning(disable:4005) // Disable "warning C4005: '_WINSOCKAPI_' : macro redefinition"
24 #include <winsock2.h>
25 #pragma warning(default:4005)
26
27 #if defined(_WIN32)
28 #include "../pthread_win32/pthread.h"
29 #include "../pthreads.h"
30 #endif
31
32 #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
33 # define __USE_FILE_OFFSET64 1
34 #endif
35
36 typedef signed __int32 int32_t;
37 typedef signed __int64 int64_t;
38 typedef unsigned __int8 uint8_t;
39 typedef unsigned __int16 uint16_t;
40 typedef unsigned __int32 uint32_t;
41 typedef unsigned __int64 uint64_t;
42
43 #if defined __USE_FILE_OFFSET64
44 typedef int64_t off_t;
45 typedef uint64_t ino_t;
46 #endif
47
48 #define usleep(t) Sleep((t)/1000)
49 #define snprintf _snprintf
50
51 #include <stddef.h>
52 #include <process.h>
53 #if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
54 #pragma warning (push)
55 #endif
56 /* prevent inclusion of wingdi.h */
57 #define NOGDI
58 #if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
59 #pragma warning (pop)
60 #endif
61 #include <io.h>
62 #include <stdlib.h>
63 #include <errno.h>
64
65 struct timezone
66 {
67 int tz_minuteswest; /* minutes west of Greenwich */
68 int tz_dsttime; /* type of dst correction */
69 };
70
71 /*!
72 \brief implements similar unix call under windows
73 \return 0 on success, -1 on failure (if pcur_time was NULL)
74 \param pcur_time points to a timeval structure, should not be NULL
75 \param tz points to a timezone structure, may be NULL
76 */
77 extern int gettimeofday(struct timeval *pcur_time, struct timezone *tz);