diff --git a/glfw/cocoa_time.c b/glfw/cocoa_time.c deleted file mode 100644 index cba8de277..000000000 --- a/glfw/cocoa_time.c +++ /dev/null @@ -1,61 +0,0 @@ -//======================================================================== -// GLFW 3.4 macOS - www.glfw.org -//------------------------------------------------------------------------ -// Copyright (c) 2009-2016 Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// It is fine to use C99 in this file because it will not be built with VS -//======================================================================== - -#include "internal.h" - -#include - - -////////////////////////////////////////////////////////////////////////// -////// GLFW internal API ////// -////////////////////////////////////////////////////////////////////////// - -// Initialise timer -// -void _glfwInitTimerNS(void) -{ - mach_timebase_info_data_t info; - mach_timebase_info(&info); - - _glfw.timer.ns.frequency = (unsigned long long)((info.denom * 1e9) / info.numer); -} - - -////////////////////////////////////////////////////////////////////////// -////// GLFW platform API ////// -////////////////////////////////////////////////////////////////////////// - -uint64_t _glfwPlatformGetTimerValue(void) -{ - return mach_absolute_time(); -} - -uint64_t _glfwPlatformGetTimerFrequency(void) -{ - return _glfw.timer.ns.frequency; -} diff --git a/glfw/glfw3.h b/glfw/glfw3.h index 1305e867e..8912396b5 100644 --- a/glfw/glfw3.h +++ b/glfw/glfw3.h @@ -5227,9 +5227,6 @@ GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); * has been set using @ref glfwSetTime it measures time elapsed since GLFW was * initialized. * - * This function and @ref glfwSetTime are helper functions on top of @ref - * glfwGetTimerFrequency and @ref glfwGetTimerValue. - * * The resolution of the timer is system dependent, but is usually on the order * of a few micro- or nanoseconds. It uses the highest-resolution monotonic * time source on each supported platform. @@ -5251,78 +5248,6 @@ GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window); */ GLFWAPI monotonic_t glfwGetTime(void); -/*! @brief Sets the GLFW time. - * - * This function sets the current GLFW time, in seconds. The value must be - * a positive finite number less than or equal to 18446744073.0, which is - * approximately 584.5 years. - * - * This function and @ref glfwGetTime are helper functions on top of @ref - * glfwGetTimerFrequency and @ref glfwGetTimerValue. - * - * @param[in] time The new value, in seconds. - * - * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref - * GLFW_INVALID_VALUE. - * - * @remark The upper limit of GLFW time is calculated as - * floor((264 - 1) / 109) and is due to implementations - * storing nanoseconds in 64 bits. The limit may be increased in the future. - * - * @thread_safety This function may be called from any thread. Reading and - * writing of the internal base time is not atomic, so it needs to be - * externally synchronized with calls to @ref glfwGetTime. - * - * @sa @ref time - * - * @since Added in version 2.2. - * - * @ingroup input - */ -GLFWAPI void glfwSetTime(monotonic_t time); - -/*! @brief Returns the current value of the raw timer. - * - * This function returns the current value of the raw timer, measured in - * 1 / frequency seconds. To get the frequency, call @ref - * glfwGetTimerFrequency. - * - * @return The value of the timer, or zero if an - * [error](@ref error_handling) occurred. - * - * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. - * - * @thread_safety This function may be called from any thread. - * - * @sa @ref time - * @sa @ref glfwGetTimerFrequency - * - * @since Added in version 3.2. - * - * @ingroup input - */ -GLFWAPI uint64_t glfwGetTimerValue(void); - -/*! @brief Returns the frequency, in Hz, of the raw timer. - * - * This function returns the frequency, in Hz, of the raw timer. - * - * @return The frequency of the timer, in Hz, or zero if an - * [error](@ref error_handling) occurred. - * - * @errors Possible errors include @ref GLFW_NOT_INITIALIZED. - * - * @thread_safety This function may be called from any thread. - * - * @sa @ref time - * @sa @ref glfwGetTimerValue - * - * @since Added in version 3.2. - * - * @ingroup input - */ -GLFWAPI uint64_t glfwGetTimerFrequency(void); - /*! @brief Makes the context of the specified window current for the calling * thread. * diff --git a/glfw/init.c b/glfw/init.c index 6318427c2..1df39bc01 100644 --- a/glfw/init.c +++ b/glfw/init.c @@ -240,7 +240,6 @@ GLFWAPI int glfwInit(monotonic_t start_time) _glfwPlatformSetTls(&_glfw.errorSlot, &_glfwMainThreadError); _glfw.initialized = true; - _glfw.timer.offset = _glfwPlatformGetTimerValue(); glfwDefaultWindowHints(); diff --git a/glfw/input.c b/glfw/input.c index afa179768..24cba60d3 100644 --- a/glfw/input.c +++ b/glfw/input.c @@ -1483,28 +1483,3 @@ GLFWAPI monotonic_t glfwGetTime(void) _GLFW_REQUIRE_INIT_OR_RETURN(0); return monotonic(); } - -GLFWAPI void glfwSetTime(monotonic_t time) -{ - _GLFW_REQUIRE_INIT(); - - if (time < 0) - { - _glfwInputError(GLFW_INVALID_VALUE, "Invalid time %f", monotonic_t_to_s_double(time)); - return; - } - - // Do nothing -} - -GLFWAPI uint64_t glfwGetTimerValue(void) -{ - _GLFW_REQUIRE_INIT_OR_RETURN(0); - return _glfwPlatformGetTimerValue(); -} - -GLFWAPI uint64_t glfwGetTimerFrequency(void) -{ - _GLFW_REQUIRE_INIT_OR_RETURN(0); - return _glfwPlatformGetTimerFrequency(); -} diff --git a/glfw/internal.h b/glfw/internal.h index 8ea3de86d..5e6f00c1f 100644 --- a/glfw/internal.h +++ b/glfw/internal.h @@ -574,12 +574,6 @@ struct _GLFWlibrary _GLFWtls contextSlot; _GLFWmutex errorLock; - struct { - uint64_t offset; - // This is defined in the platform's time.h - _GLFW_PLATFORM_LIBRARY_TIMER_STATE; - } timer; - struct { bool available; void* handle; @@ -663,9 +657,6 @@ const char* _glfwPlatformGetPrimarySelectionString(void); int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode); void _glfwPlatformUpdateGamepadGUID(char* guid); -uint64_t _glfwPlatformGetTimerValue(void); -uint64_t _glfwPlatformGetTimerFrequency(void); - int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, diff --git a/glfw/null_init.c b/glfw/null_init.c index 6f7ec9b52..bebc5d350 100644 --- a/glfw/null_init.c +++ b/glfw/null_init.c @@ -36,7 +36,6 @@ int _glfwPlatformInit(void) { - _glfwInitTimerPOSIX(); return true; } @@ -49,4 +48,3 @@ const char* _glfwPlatformGetVersionString(void) { return _GLFW_VERSION_NUMBER " null OSMesa"; } - diff --git a/glfw/posix_time.c b/glfw/posix_time.c deleted file mode 100644 index aba41a4d2..000000000 --- a/glfw/posix_time.c +++ /dev/null @@ -1,87 +0,0 @@ -//======================================================================== -// GLFW 3.4 POSIX - www.glfw.org -//------------------------------------------------------------------------ -// Copyright (c) 2002-2006 Marcus Geelnard -// Copyright (c) 2006-2017 Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== -// It is fine to use C99 in this file because it will not be built with VS -//======================================================================== - -#include "internal.h" - -#include -#include - - -////////////////////////////////////////////////////////////////////////// -////// GLFW internal API ////// -////////////////////////////////////////////////////////////////////////// - -// Initialise timer -// -void _glfwInitTimerPOSIX(void) -{ -#if defined(CLOCK_MONOTONIC) - struct timespec ts; - - if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) - { - _glfw.timer.posix.monotonic = true; - _glfw.timer.posix.frequency = 1000000000; - } - else -#endif - { - _glfw.timer.posix.monotonic = false; - _glfw.timer.posix.frequency = 1000000; - } -} - - -////////////////////////////////////////////////////////////////////////// -////// GLFW platform API ////// -////////////////////////////////////////////////////////////////////////// - -uint64_t _glfwPlatformGetTimerValue(void) -{ -#if defined(CLOCK_MONOTONIC) - if (_glfw.timer.posix.monotonic) - { - struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - return (uint64_t) ts.tv_sec * (uint64_t) 1000000000 + (uint64_t) ts.tv_nsec; - } - else -#endif - { - struct timeval tv; - gettimeofday(&tv, NULL); - return (uint64_t) tv.tv_sec * (uint64_t) 1000000 + (uint64_t) tv.tv_usec; - } -} - -uint64_t _glfwPlatformGetTimerFrequency(void) -{ - return _glfw.timer.posix.frequency; -} - diff --git a/glfw/posix_time.h b/glfw/posix_time.h deleted file mode 100644 index 25628dfd1..000000000 --- a/glfw/posix_time.h +++ /dev/null @@ -1,44 +0,0 @@ -//======================================================================== -// GLFW 3.4 POSIX - www.glfw.org -//------------------------------------------------------------------------ -// Copyright (c) 2002-2006 Marcus Geelnard -// Copyright (c) 2006-2017 Camilla Löwy -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would -// be appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not -// be misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source -// distribution. -// -//======================================================================== - -#define _GLFW_PLATFORM_LIBRARY_TIMER_STATE _GLFWtimerPOSIX posix - -#include - - -// POSIX-specific global timer data -// -typedef struct _GLFWtimerPOSIX -{ - bool monotonic; - uint64_t frequency; - -} _GLFWtimerPOSIX; - - -void _glfwInitTimerPOSIX(void); - diff --git a/glfw/source-info.json b/glfw/source-info.json index 20018ff72..a2edff35d 100644 --- a/glfw/source-info.json +++ b/glfw/source-info.json @@ -13,7 +13,6 @@ "cocoa_joystick.m", "cocoa_monitor.m", "cocoa_window.m", - "cocoa_time.c", "posix_thread.c", "nsgl_context.m", "egl_context.c", @@ -39,7 +38,6 @@ "headers": [ "null_platform.h", "null_joystick.h", - "posix_time.h", "posix_thread.h", "osmesa_context.h" ], @@ -48,7 +46,6 @@ "null_monitor.c", "null_window.c", "null_joystick.c", - "posix_time.c", "posix_thread.c", "osmesa_context.c" ] @@ -56,7 +53,6 @@ "wayland": { "headers": [ "wl_platform.h", - "posix_time.h", "posix_thread.h", "xkb_glfw.h", "dbus_glfw.h", @@ -82,7 +78,6 @@ "wl_init.c", "wl_monitor.c", "wl_window.c", - "posix_time.c", "posix_thread.c", "xkb_glfw.c", "dbus_glfw.c", @@ -126,7 +121,6 @@ "dbus_glfw.h", "ibus_glfw.h", "backend_utils.h", - "posix_time.h", "posix_thread.h", "glx_context.h", "egl_context.h", @@ -143,7 +137,6 @@ "xkb_glfw.c", "dbus_glfw.c", "ibus_glfw.c", - "posix_time.c", "posix_thread.c", "glx_context.c", "egl_context.c", diff --git a/glfw/wl_init.c b/glfw/wl_init.c index 3c9811424..077dc52e6 100644 --- a/glfw/wl_init.c +++ b/glfw/wl_init.c @@ -766,7 +766,6 @@ int _glfwPlatformInit(void) } #endif - _glfwInitTimerPOSIX(); if (!_glfw.wl.wmBase) { _glfwInputError(GLFW_PLATFORM_ERROR, diff --git a/glfw/wl_platform.h b/glfw/wl_platform.h index 2718aae3a..ac529daa4 100644 --- a/glfw/wl_platform.h +++ b/glfw/wl_platform.h @@ -43,7 +43,6 @@ typedef VkResult (APIENTRY *PFN_vkCreateWaylandSurfaceKHR)(VkInstance,const VkWa typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice,uint32_t,struct wl_display*); #include "posix_thread.h" -#include "posix_time.h" #ifdef __linux__ #include "linux_joystick.h" #else diff --git a/glfw/x11_init.c b/glfw/x11_init.c index 6b6a394e3..dc18fd5aa 100644 --- a/glfw/x11_init.c +++ b/glfw/x11_init.c @@ -635,8 +635,6 @@ int _glfwPlatformInit(void) } #endif - _glfwInitTimerPOSIX(); - _glfwPollMonitorsX11(); return true; } diff --git a/glfw/x11_platform.h b/glfw/x11_platform.h index 053ca19fa..eb5e576c1 100644 --- a/glfw/x11_platform.h +++ b/glfw/x11_platform.h @@ -152,7 +152,6 @@ typedef VkResult (APIENTRY *PFN_vkCreateXcbSurfaceKHR)(VkInstance,const VkXcbSur typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice,uint32_t,xcb_connection_t*,xcb_visualid_t); #include "posix_thread.h" -#include "posix_time.h" #include "glx_context.h" #include "egl_context.h" #include "osmesa_context.h" diff --git a/kitty/glfw-wrapper.c b/kitty/glfw-wrapper.c index b96823971..521df07c6 100644 --- a/kitty/glfw-wrapper.c +++ b/kitty/glfw-wrapper.c @@ -344,15 +344,6 @@ load_glfw(const char* path) { *(void **) (&glfwGetTime_impl) = dlsym(handle, "glfwGetTime"); if (glfwGetTime_impl == NULL) fail("Failed to load glfw function glfwGetTime with error: %s", dlerror()); - *(void **) (&glfwSetTime_impl) = dlsym(handle, "glfwSetTime"); - if (glfwSetTime_impl == NULL) fail("Failed to load glfw function glfwSetTime with error: %s", dlerror()); - - *(void **) (&glfwGetTimerValue_impl) = dlsym(handle, "glfwGetTimerValue"); - if (glfwGetTimerValue_impl == NULL) fail("Failed to load glfw function glfwGetTimerValue with error: %s", dlerror()); - - *(void **) (&glfwGetTimerFrequency_impl) = dlsym(handle, "glfwGetTimerFrequency"); - if (glfwGetTimerFrequency_impl == NULL) fail("Failed to load glfw function glfwGetTimerFrequency with error: %s", dlerror()); - *(void **) (&glfwMakeContextCurrent_impl) = dlsym(handle, "glfwMakeContextCurrent"); if (glfwMakeContextCurrent_impl == NULL) fail("Failed to load glfw function glfwMakeContextCurrent with error: %s", dlerror()); diff --git a/kitty/glfw-wrapper.h b/kitty/glfw-wrapper.h index 67876d0ab..d4076699c 100644 --- a/kitty/glfw-wrapper.h +++ b/kitty/glfw-wrapper.h @@ -2022,18 +2022,6 @@ typedef monotonic_t (*glfwGetTime_func)(void); glfwGetTime_func glfwGetTime_impl; #define glfwGetTime glfwGetTime_impl -typedef void (*glfwSetTime_func)(monotonic_t); -glfwSetTime_func glfwSetTime_impl; -#define glfwSetTime glfwSetTime_impl - -typedef uint64_t (*glfwGetTimerValue_func)(void); -glfwGetTimerValue_func glfwGetTimerValue_impl; -#define glfwGetTimerValue glfwGetTimerValue_impl - -typedef uint64_t (*glfwGetTimerFrequency_func)(void); -glfwGetTimerFrequency_func glfwGetTimerFrequency_impl; -#define glfwGetTimerFrequency glfwGetTimerFrequency_impl - typedef void (*glfwMakeContextCurrent_func)(GLFWwindow*); glfwMakeContextCurrent_func glfwMakeContextCurrent_impl; #define glfwMakeContextCurrent glfwMakeContextCurrent_impl diff --git a/setup.py b/setup.py index 938fed538..f450b8705 100755 --- a/setup.py +++ b/setup.py @@ -336,8 +336,11 @@ def newer(dest, *sources): except EnvironmentError: return True for s in sources: - if os.path.getmtime(s) >= dtime: - return True + try: + if os.path.getmtime(s) >= dtime: + return True + except FileNotFoundError: + pass return False