aboutsummaryrefslogtreecommitdiff
path: root/Src/h264dec/lcommon/src/win32.c
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/h264dec/lcommon/src/win32.c
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/h264dec/lcommon/src/win32.c')
-rw-r--r--Src/h264dec/lcommon/src/win32.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/Src/h264dec/lcommon/src/win32.c b/Src/h264dec/lcommon/src/win32.c
new file mode 100644
index 00000000..7d921e1e
--- /dev/null
+++ b/Src/h264dec/lcommon/src/win32.c
@@ -0,0 +1,67 @@
+
+/*!
+ *************************************************************************************
+ * \file win32.c
+ *
+ * \brief
+ * Platform dependent code
+ *
+ * \author
+ * Main contributors (see contributors.h for copyright, address and affiliation details)
+ * - Karsten Suehring <suehring@hhi.de>
+ *************************************************************************************
+ */
+
+#include "global.h"
+
+
+#ifdef _WIN32
+
+static LARGE_INTEGER freq;
+
+void gettime(TIME_T* time)
+{
+ QueryPerformanceCounter(time);
+}
+
+int64 timediff(TIME_T* start, TIME_T* end)
+{
+ return (int64)((end->QuadPart - start->QuadPart));
+}
+
+int64 timenorm(int64 cur_time)
+{
+ static int first = 1;
+
+ if(first)
+ {
+ QueryPerformanceFrequency(&freq);
+ first = 0;
+ }
+
+ return (int64)(cur_time * 1000 /(freq.QuadPart));
+}
+
+#else
+
+static struct timezone tz;
+
+void gettime(TIME_T* time)
+{
+ gettimeofday(time, &tz);
+}
+
+int64 timediff(TIME_T* start, TIME_T* end)
+{
+ int t1, t2;
+
+ t1 = end->tv_sec - start->tv_sec;
+ t2 = end->tv_usec - start->tv_usec;
+ return (int64) t2 + (int64) t1 * (int64) 1000000;
+}
+
+int64 timenorm(int64 cur_time)
+{
+ return (int64)(cur_time / (int64) 1000);
+}
+#endif