From fce0114174a5eb129284676a9b3d862aa92f4d45 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 27 Mar 2014 16:08:06 +0100 Subject: [PATCH] Renamed POSIX time module. --- src/CMakeLists.txt | 4 ++-- src/{unix_time.c => posix_time.c} | 20 ++++++++++---------- src/{unix_time.h => posix_time.h} | 14 ++++++++------ src/wayland_platform.h | 6 +++--- src/x11_platform.h | 6 +++--- 5 files changed, 26 insertions(+), 24 deletions(-) rename src/{unix_time.c => posix_time.c} (82%) rename src/{unix_time.h => posix_time.h} (89%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 44270173..39bbdcd0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,8 +35,8 @@ elseif (_GLFW_WAYLAND) endif() if (_GLFW_X11 OR _GLFW_WAYLAND) - list(APPEND glfw_HEADERS linux_joystick.h unix_time.h) - list(APPEND glfw_SOURCES linux_joystick.c unix_time.c) + list(APPEND glfw_HEADERS linux_joystick.h posix_time.h) + list(APPEND glfw_SOURCES linux_joystick.c posix_time.c) endif() if (_GLFW_EGL) diff --git a/src/unix_time.c b/src/posix_time.c similarity index 82% rename from src/unix_time.c rename to src/posix_time.c index 775cb1c5..31c6824a 100644 --- a/src/unix_time.c +++ b/src/posix_time.c @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.1 UNIX - www.glfw.org +// GLFW 3.1 POSIX - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -35,7 +35,7 @@ static uint64_t getRawTime(void) { #if defined(CLOCK_MONOTONIC) - if (_GLFW_UNIX_TIME_CONTEXT.monotonic) + if (_GLFW_POSIX_TIME_CONTEXT.monotonic) { struct timespec ts; @@ -66,16 +66,16 @@ void _glfwInitTimer(void) if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { - _GLFW_UNIX_TIME_CONTEXT.monotonic = GL_TRUE; - _GLFW_UNIX_TIME_CONTEXT.resolution = 1e-9; + _GLFW_POSIX_TIME_CONTEXT.monotonic = GL_TRUE; + _GLFW_POSIX_TIME_CONTEXT.resolution = 1e-9; } else #endif { - _GLFW_UNIX_TIME_CONTEXT.resolution = 1e-6; + _GLFW_POSIX_TIME_CONTEXT.resolution = 1e-6; } - _GLFW_UNIX_TIME_CONTEXT.base = getRawTime(); + _GLFW_POSIX_TIME_CONTEXT.base = getRawTime(); } @@ -85,13 +85,13 @@ void _glfwInitTimer(void) double _glfwPlatformGetTime(void) { - return (double) (getRawTime() - _GLFW_UNIX_TIME_CONTEXT.base) * - _GLFW_UNIX_TIME_CONTEXT.resolution; + return (double) (getRawTime() - _GLFW_POSIX_TIME_CONTEXT.base) * + _GLFW_POSIX_TIME_CONTEXT.resolution; } void _glfwPlatformSetTime(double time) { - _GLFW_UNIX_TIME_CONTEXT.base = getRawTime() - - (uint64_t) (time / _GLFW_UNIX_TIME_CONTEXT.resolution); + _GLFW_POSIX_TIME_CONTEXT.base = getRawTime() - + (uint64_t) (time / _GLFW_POSIX_TIME_CONTEXT.resolution); } diff --git a/src/unix_time.h b/src/posix_time.h similarity index 89% rename from src/unix_time.h rename to src/posix_time.h index 34294732..9873364a 100644 --- a/src/unix_time.h +++ b/src/posix_time.h @@ -1,5 +1,5 @@ //======================================================================== -// GLFW 3.1 UNIX - www.glfw.org +// GLFW 3.1 POSIX - www.glfw.org //------------------------------------------------------------------------ // Copyright (c) 2002-2006 Marcus Geelnard // Copyright (c) 2006-2010 Camilla Berglund @@ -25,18 +25,20 @@ // //======================================================================== -#ifndef _unix_time_h_ -#define _unix_time_h_ +#ifndef _posix_time_h_ +#define _posix_time_h_ #include #include -typedef struct _GLFWtimeUNIX{ +typedef struct _GLFWtimePOSIX +{ GLboolean monotonic; double resolution; uint64_t base; -} _GLFWtimeUNIX; + +} _GLFWtimePOSIX; void _glfwInitTimer(void); -#endif // _unix_time_h_ +#endif // _posix_time_h_ diff --git a/src/wayland_platform.h b/src/wayland_platform.h index 66f71c93..810fc0c9 100644 --- a/src/wayland_platform.h +++ b/src/wayland_platform.h @@ -38,8 +38,8 @@ #include "linux_joystick.h" -#define _GLFW_UNIX_TIME_CONTEXT _glfw.wl.timer -#include "unix_time.h" +#define _GLFW_POSIX_TIME_CONTEXT _glfw.wl.timer +#include "posix_time.h" #define _GLFW_EGL_NATIVE_WINDOW window->wl.native #define _GLFW_EGL_NATIVE_DISPLAY _glfw.wl.display @@ -73,7 +73,7 @@ typedef struct _GLFWlibraryWayland int monitorsCount; int monitorsSize; - _GLFWtimeUNIX timer; + _GLFWtimePOSIX timer; } _GLFWlibraryWayland; typedef struct _GLFWmonitorWayland diff --git a/src/x11_platform.h b/src/x11_platform.h index 6962b045..b8b0bb86 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -62,8 +62,8 @@ #error "No supported context creation API selected" #endif -#define _GLFW_UNIX_TIME_CONTEXT _glfw.x11.timer -#include "unix_time.h" +#define _GLFW_POSIX_TIME_CONTEXT _glfw.x11.timer +#include "posix_time.h" #include "linux_joystick.h" @@ -204,7 +204,7 @@ typedef struct _GLFWlibraryX11 int exposure; } saver; - _GLFWtimeUNIX timer; + _GLFWtimePOSIX timer; struct { char* string;