mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-11 14:45:31 +03:00
Fix #2187
This commit is contained in:
parent
e3e02c7271
commit
7bf0afa621
1
glfw/init.c
vendored
1
glfw/init.c
vendored
@ -27,7 +27,6 @@
|
||||
// Please use C89 style variable declarations in this file because VS 2010
|
||||
//========================================================================
|
||||
|
||||
#define MONOTONIC_START_MODULE
|
||||
#include "internal.h"
|
||||
#include "mappings.h"
|
||||
|
||||
|
10
glfw/monotonic.c
vendored
Normal file
10
glfw/monotonic.c
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
* monotonic.c
|
||||
* Copyright (C) 2019 Kovid Goyal <kovid at kovidgoyal.net>
|
||||
*
|
||||
* Distributed under terms of the GPL3 license.
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
#define MONOTONIC_IMPLEMENTATION
|
||||
#include "../kitty/monotonic.h"
|
@ -31,6 +31,7 @@
|
||||
"input.c",
|
||||
"monitor.c",
|
||||
"vulkan.c",
|
||||
"monotonic.c",
|
||||
"window.c"
|
||||
]
|
||||
},
|
||||
|
@ -5,7 +5,6 @@
|
||||
* Distributed under terms of the GPL3 license.
|
||||
*/
|
||||
|
||||
#define MONOTONIC_START_MODULE
|
||||
#ifdef __APPLE__
|
||||
// Needed for _CS_DARWIN_USER_CACHE_DIR
|
||||
#define _DARWIN_C_SOURCE
|
||||
|
10
kitty/monotonic.c
Normal file
10
kitty/monotonic.c
Normal file
@ -0,0 +1,10 @@
|
||||
/*
|
||||
* monotonic.c
|
||||
* Copyright (C) 2019 Kovid Goyal <kovid at kovidgoyal.net>
|
||||
*
|
||||
* Distributed under terms of the GPL3 license.
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
#define MONOTONIC_IMPLEMENTATION
|
||||
#include "monotonic.h"
|
@ -61,14 +61,21 @@ static inline double monotonic_t_to_s_double(monotonic_t time) {
|
||||
return (double)time / 1000.0 / 1000.0 / 1000.0;
|
||||
}
|
||||
|
||||
#ifdef MONOTONIC_START_MODULE
|
||||
monotonic_t monotonic_start_time = 0;
|
||||
#else
|
||||
extern monotonic_t monotonic_start_time;
|
||||
#endif
|
||||
extern monotonic_t monotonic_(void);
|
||||
|
||||
static inline monotonic_t monotonic(void) {
|
||||
return monotonic_() - monotonic_start_time;
|
||||
}
|
||||
|
||||
static inline monotonic_t monotonic_(void) {
|
||||
static inline void init_monotonic(void) {
|
||||
monotonic_start_time = monotonic_();
|
||||
}
|
||||
|
||||
#ifdef MONOTONIC_IMPLEMENTATION
|
||||
monotonic_t monotonic_start_time = 0;
|
||||
|
||||
monotonic_t monotonic_(void) {
|
||||
struct timespec ts = {0};
|
||||
#ifdef CLOCK_HIGHRES
|
||||
clock_gettime(CLOCK_HIGHRES, &ts);
|
||||
@ -79,11 +86,4 @@ static inline monotonic_t monotonic_(void) {
|
||||
#endif
|
||||
return calc_nano_time(ts);
|
||||
}
|
||||
|
||||
static inline monotonic_t monotonic(void) {
|
||||
return monotonic_() - monotonic_start_time;
|
||||
}
|
||||
|
||||
static inline void init_monotonic(void) {
|
||||
monotonic_start_time = monotonic_();
|
||||
}
|
||||
#endif
|
||||
|
3
setup.py
3
setup.py
@ -212,10 +212,9 @@ def init_env(
|
||||
cppflags = shlex.split(cppflags)
|
||||
for el in extra_logging:
|
||||
cppflags.append('-DDEBUG_{}'.format(el.upper().replace('-', '_')))
|
||||
# _POSIX_C_SOURCE is needed for clock_gettime() in monotonic.h
|
||||
cflags = os.environ.get(
|
||||
'OVERRIDE_CFLAGS', (
|
||||
'-Wextra {} -Wno-missing-field-initializers -Wall -Wstrict-prototypes -D_POSIX_C_SOURCE=200809L -std=c11'
|
||||
'-Wextra {} -Wno-missing-field-initializers -Wall -Wstrict-prototypes -std=c11'
|
||||
' -pedantic-errors -Werror {} {} -fwrapv {} {} -pipe {} -fvisibility=hidden'
|
||||
).format(
|
||||
float_conversion,
|
||||
|
Loading…
Reference in New Issue
Block a user