Compare commits

...

3 Commits

Author SHA1 Message Date
3ee0fd6f92 Slap u64 on everything time-y
* get_us_time() will overflow and reset to zero every now and then.
  Had it happen several times in one day,
  https://github.com/minetest/minetest/issues/10105
* backported b5eda416ce

Signed-off-by: mckaygerhard <mckaygerhard@gmail.com>
2023-09-17 15:13:12 -04:00
19afb03d0b Fix linking with Postgres libs on older cmake versions
* integrates https://github.com/minetest/minetest/pull/11215
  so it backported a24899bf2d
* closes https://github.com/minetest/minetest/issues/12149
* closes https://github.com/minetest/minetest/issues/11219
* backported 998e4820c9
2023-09-12 21:45:49 -04:00
545ed62909 Fix no locales being generated when APPLY_LOCALE_BLACKLIST=0
* backported 6caed7073c
  from upstream
2023-09-12 21:25:17 -04:00
2 changed files with 30 additions and 16 deletions

View File

@ -174,21 +174,33 @@ option(ENABLE_POSTGRESQL "Enable PostgreSQL backend" TRUE)
set(USE_POSTGRESQL FALSE)
if(ENABLE_POSTGRESQL)
find_program(POSTGRESQL_CONFIG_EXECUTABLE pg_config DOC "pg_config")
find_library(POSTGRESQL_LIBRARY pq)
if(POSTGRESQL_CONFIG_EXECUTABLE)
execute_process(COMMAND ${POSTGRESQL_CONFIG_EXECUTABLE} --includedir-server
OUTPUT_VARIABLE POSTGRESQL_SERVER_INCLUDE_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${POSTGRESQL_CONFIG_EXECUTABLE}
OUTPUT_VARIABLE POSTGRESQL_CLIENT_INCLUDE_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE)
# This variable is case sensitive for the cmake PostgreSQL module
set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${POSTGRESQL_SERVER_INCLUDE_DIRS} ${POSTGRESQL_CLIENT_INCLUDE_DIRS})
if(CMAKE_VERSION VERSION_LESS "3.10")
find_package(PostgreSQL QUIET)
# Before CMake 3.20 FindPostgreSQL.cmake always looked for server includes
# but we don't need them, so continue anyway if only those are missing.
if(PostgreSQL_INCLUDE_DIR AND PostgreSQL_LIBRARY)
set(PostgreSQL_FOUND TRUE)
set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR})
set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY})
else()
find_program(POSTGRESQL_CONFIG_EXECUTABLE pg_config DOC "pg_config")
find_library(POSTGRESQL_LIBRARY pq)
if(POSTGRESQL_CONFIG_EXECUTABLE)
execute_process(COMMAND ${POSTGRESQL_CONFIG_EXECUTABLE} --includedir-server
OUTPUT_VARIABLE POSTGRESQL_SERVER_INCLUDE_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${POSTGRESQL_CONFIG_EXECUTABLE}
OUTPUT_VARIABLE POSTGRESQL_CLIENT_INCLUDE_DIRS
OUTPUT_STRIP_TRAILING_WHITESPACE)
# This variable is case sensitive for the cmake PostgreSQL module
set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${POSTGRESQL_SERVER_INCLUDE_DIRS} ${POSTGRESQL_CLIENT_INCLUDE_DIRS})
endif()
find_package("PostgreSQL")
endif()
else()
find_package(PostgreSQL)
endif()
find_package("PostgreSQL")
if(POSTGRESQL_FOUND)
set(USE_POSTGRESQL TRUE)
message(STATUS "PostgreSQL backend enabled")
@ -702,6 +714,8 @@ if (GETTEXT_FOUND AND APPLY_LOCALE_BLACKLIST)
endif()
endforeach()
message(STATUS "Locale blacklist applied; Locales used: ${GETTEXT_USED_LOCALES}")
elseif (GETTEXTLIB_FOUND)
set(GETTEXT_USED_LOCALES ${GETTEXT_AVAILABLE_LOCALES})
endif()
# Set some optimizations and tweaks

View File

@ -237,21 +237,21 @@ inline u64 getTimeMs()
{
struct timespec ts;
os_get_clock(&ts);
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
return ((u64) ts.tv_sec) * 1000LL + ((u64) ts.tv_nsec) / 1000000LL;
}
inline u64 getTimeUs()
{
struct timespec ts;
os_get_clock(&ts);
return ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
return ((u64) ts.tv_sec) * 1000000LL + ((u64) ts.tv_nsec) / 1000LL;
}
inline u64 getTimeNs()
{
struct timespec ts;
os_get_clock(&ts);
return ts.tv_sec * 1000000000 + ts.tv_nsec;
return ((u64) ts.tv_sec) * 1000000000LL + ((u64) ts.tv_nsec);
}
#endif