1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 10:48:51 -05:00

Renamed POSIX time module.

This commit is contained in:
Camilla Berglund 2014-03-27 16:08:06 +01:00
parent 0e4096e201
commit fce0114174
5 changed files with 26 additions and 24 deletions

View File

@ -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)

View File

@ -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 <elmindreda@elmindreda.org>
@ -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);
}

View File

@ -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 <elmindreda@elmindreda.org>
@ -25,18 +25,20 @@
//
//========================================================================
#ifndef _unix_time_h_
#define _unix_time_h_
#ifndef _posix_time_h_
#define _posix_time_h_
#include <stdint.h>
#include <GL/gl.h>
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_

View File

@ -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

View File

@ -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;