aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/gettimeofday
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/gettimeofday')
-rw-r--r--vcpkg/ports/gettimeofday/CMakeLists.txt14
-rw-r--r--vcpkg/ports/gettimeofday/LICENSE33
-rw-r--r--vcpkg/ports/gettimeofday/gettimeofday.c67
-rw-r--r--vcpkg/ports/gettimeofday/gettimeofday.def2
-rw-r--r--vcpkg/ports/gettimeofday/gettimeofday.h13
-rw-r--r--vcpkg/ports/gettimeofday/portfile.cmake8
-rw-r--r--vcpkg/ports/gettimeofday/vcpkg.json12
7 files changed, 149 insertions, 0 deletions
diff --git a/vcpkg/ports/gettimeofday/CMakeLists.txt b/vcpkg/ports/gettimeofday/CMakeLists.txt
new file mode 100644
index 0000000..1f8d891
--- /dev/null
+++ b/vcpkg/ports/gettimeofday/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.8)
+project(gettimeofday C)
+
+add_library(gettimeofday gettimeofday.c gettimeofday.def)
+
+install(TARGETS gettimeofday
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib/manual-link
+ LIBRARY DESTINATION lib/manual-link
+)
+
+if(CMAKE_BUILD_TYPE STREQUAL "Release")
+ install(FILES gettimeofday.h DESTINATION include)
+endif()
diff --git a/vcpkg/ports/gettimeofday/LICENSE b/vcpkg/ports/gettimeofday/LICENSE
new file mode 100644
index 0000000..57c986d
--- /dev/null
+++ b/vcpkg/ports/gettimeofday/LICENSE
@@ -0,0 +1,33 @@
+/*
+ * Copied from PostgreSQL source:
+ * http://doxygen.postgresql.org/gettimeofday_8c_source.html
+ *
+ */
+
+/*
+ * gettimeofday.c
+ * Win32 gettimeofday() replacement
+ *
+ * src/port/gettimeofday.c
+ *
+ * Copyright (c) 2003 SRA, Inc.
+ * Copyright (c) 2003 SKC, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose, without fee, and without a
+ * written agreement is hereby granted, provided that the above
+ * copyright notice and this paragraph and the following two
+ * paragraphs appear in all copies.
+ *
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
+ * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
+ * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
+ * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS
+ * IS" BASIS, AND THE AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE,
+ * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ */
diff --git a/vcpkg/ports/gettimeofday/gettimeofday.c b/vcpkg/ports/gettimeofday/gettimeofday.c
new file mode 100644
index 0000000..62abf34
--- /dev/null
+++ b/vcpkg/ports/gettimeofday/gettimeofday.c
@@ -0,0 +1,67 @@
+/*
+ * Copied from PostgreSQL source:
+ * http://doxygen.postgresql.org/gettimeofday_8c_source.html
+ *
+ */
+
+/*
+ * gettimeofday.c
+ * Win32 gettimeofday() replacement
+ *
+ * src/port/gettimeofday.c
+ *
+ * Copyright (c) 2003 SRA, Inc.
+ * Copyright (c) 2003 SKC, Inc.
+ *
+ * Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose, without fee, and without a
+ * written agreement is hereby granted, provided that the above
+ * copyright notice and this paragraph and the following two
+ * paragraphs appear in all copies.
+ *
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
+ * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
+ * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
+ * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS
+ * IS" BASIS, AND THE AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE,
+ * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ */
+
+#ifdef _MSC_VER
+
+#include <winsock2.h>
+
+
+/* FILETIME of Jan 1 1970 00:00:00. */
+static const unsigned __int64 epoch = 116444736000000000Ui64;
+
+/*
+ * timezone information is stored outside the kernel so tzp isn't used anymore.
+ *
+ * Note: this function is not for Win32 high precision timing purpose. See
+ * elapsed_time().
+ */
+int
+gettimeofday(struct timeval * tp, struct timezone * tzp)
+{
+ FILETIME file_time;
+ SYSTEMTIME system_time;
+ ULARGE_INTEGER ularge;
+
+ GetSystemTime(&system_time);
+ SystemTimeToFileTime(&system_time, &file_time);
+ ularge.LowPart = file_time.dwLowDateTime;
+ ularge.HighPart = file_time.dwHighDateTime;
+
+ tp->tv_sec = (long) ((ularge.QuadPart - epoch) / 10000000L);
+ tp->tv_usec = (long) (system_time.wMilliseconds * 1000);
+
+ return 0;
+}
+
+#endif /* _MSC_VER */
diff --git a/vcpkg/ports/gettimeofday/gettimeofday.def b/vcpkg/ports/gettimeofday/gettimeofday.def
new file mode 100644
index 0000000..7a46b86
--- /dev/null
+++ b/vcpkg/ports/gettimeofday/gettimeofday.def
@@ -0,0 +1,2 @@
+EXPORTS
+ gettimeofday
diff --git a/vcpkg/ports/gettimeofday/gettimeofday.h b/vcpkg/ports/gettimeofday/gettimeofday.h
new file mode 100644
index 0000000..2273175
--- /dev/null
+++ b/vcpkg/ports/gettimeofday/gettimeofday.h
@@ -0,0 +1,13 @@
+#ifndef _MY_GETTIMEOFDAY_H_
+#define _MY_GETTIMEOFDAY_H_
+
+#ifdef _MSC_VER
+
+#include <winsock2.h>
+#include <time.h>
+
+int gettimeofday(struct timeval * tp, struct timezone * tzp);
+
+#endif /* _MSC_VER */
+
+#endif /* _MY_GETTIMEOFDAY_H_ */
diff --git a/vcpkg/ports/gettimeofday/portfile.cmake b/vcpkg/ports/gettimeofday/portfile.cmake
new file mode 100644
index 0000000..0b4d4b8
--- /dev/null
+++ b/vcpkg/ports/gettimeofday/portfile.cmake
@@ -0,0 +1,8 @@
+vcpkg_cmake_configure(
+ SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}"
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/vcpkg/ports/gettimeofday/vcpkg.json b/vcpkg/ports/gettimeofday/vcpkg.json
new file mode 100644
index 0000000..c4b387f
--- /dev/null
+++ b/vcpkg/ports/gettimeofday/vcpkg.json
@@ -0,0 +1,12 @@
+{
+ "name": "gettimeofday",
+ "version-date": "2017-10-14",
+ "port-version": 6,
+ "description": "An implementation of gettimeofday for WIN32",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ }
+ ]
+}