ae17d63b6537e93d09bbce38fd9f4659ceef7ae5
[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 #include "../pthread_win32/pthread.h"
28
29 #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
30 # define __USE_FILE_OFFSET64 1
31 #endif
32
33 typedef signed __int32 int32_t;
34 typedef signed __int64 int64_t;
35 typedef unsigned __int8 uint8_t;
36 typedef unsigned __int16 uint16_t;
37 typedef unsigned __int32 uint32_t;
38 typedef unsigned __int64 uint64_t;
39
40 #if defined __USE_FILE_OFFSET64
41 typedef int64_t off_t;
42 typedef uint64_t ino_t;
43 #endif
44
45 #define usleep(t) Sleep((t)/1000)
46 #define snprintf _snprintf
47
48 #include <stddef.h>
49 #include <process.h>
50 #if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
51 #pragma warning (push)
52 #endif
53 /* prevent inclusion of wingdi.h */
54 #define NOGDI
55 #if defined(_MSC_VER) /* Microsoft C Compiler ONLY */
56 #pragma warning (pop)
57 #endif
58 #include <io.h>
59 #include <stdlib.h>
60 #include <errno.h>
61
62 struct timezone
63 {
64 int tz_minuteswest; /* minutes west of Greenwich */
65 int tz_dsttime; /* type of dst correction */
66 };
67
68 /*!
69 \brief implements similar unix call under windows
70 \return 0 on success, -1 on failure (if pcur_time was NULL)
71 \param pcur_time points to a timeval structure, should not be NULL
72 \param tz points to a timezone structure, may be NULL
73 */
74 extern int gettimeofday(struct timeval *pcur_time, struct timezone *tz);