summaryrefslogtreecommitdiffstats
path: root/xbmc/utils/XTimeUtils.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
committermanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
commitbe933ef2241d79558f91796cc5b3a161f72ebf9c (patch)
treefe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/utils/XTimeUtils.h
parent5f8335c1e49ce108ef3481863833c98efa00411b (diff)
downloadkodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip
sync with upstream
Diffstat (limited to 'xbmc/utils/XTimeUtils.h')
-rw-r--r--xbmc/utils/XTimeUtils.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/xbmc/utils/XTimeUtils.h b/xbmc/utils/XTimeUtils.h
new file mode 100644
index 0000000..721c1f7
--- /dev/null
+++ b/xbmc/utils/XTimeUtils.h
@@ -0,0 +1,76 @@
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include <string>
12
13#if !defined(TARGET_WINDOWS)
14#include "PlatformDefs.h"
15#else
16// This is needed, a forward declaration of FILETIME
17// breaks everything
18#ifndef WIN32_LEAN_AND_MEAN
19#define WIN32_LEAN_AND_MEAN
20#endif
21#include <Windows.h>
22#endif
23
24namespace KODI
25{
26namespace TIME
27{
28struct SystemTime
29{
30 unsigned short year;
31 unsigned short month;
32 unsigned short dayOfWeek;
33 unsigned short day;
34 unsigned short hour;
35 unsigned short minute;
36 unsigned short second;
37 unsigned short milliseconds;
38};
39
40struct TimeZoneInformation
41{
42 long bias;
43 std::string standardName;
44 SystemTime standardDate;
45 long standardBias;
46 std::string daylightName;
47 SystemTime daylightDate;
48 long daylightBias;
49};
50
51constexpr int KODI_TIME_ZONE_ID_INVALID{-1};
52constexpr int KODI_TIME_ZONE_ID_UNKNOWN{0};
53constexpr int KODI_TIME_ZONE_ID_STANDARD{1};
54constexpr int KODI_TIME_ZONE_ID_DAYLIGHT{2};
55
56struct FileTime
57{
58 unsigned int lowDateTime;
59 unsigned int highDateTime;
60};
61
62void GetLocalTime(SystemTime* systemTime);
63uint32_t GetTimeZoneInformation(TimeZoneInformation* timeZoneInformation);
64
65void Sleep(uint32_t milliSeconds);
66
67int FileTimeToLocalFileTime(const FileTime* fileTime, FileTime* localFileTime);
68int SystemTimeToFileTime(const SystemTime* systemTime, FileTime* fileTime);
69long CompareFileTime(const FileTime* fileTime1, const FileTime* fileTime2);
70int FileTimeToSystemTime(const FileTime* fileTime, SystemTime* systemTime);
71int LocalFileTimeToFileTime(const FileTime* LocalFileTime, FileTime* fileTime);
72
73int FileTimeToTimeT(const FileTime* localFileTime, time_t* pTimeT);
74int TimeTToFileTime(time_t timeT, FileTime* localFileTime);
75} // namespace TIME
76} // namespace KODI