fix std::string_view
Some checks failed
rpcrypto-build / build (Debug, hisiv510.toolchain.cmake) (push) Failing after 55s
linux-x64-gcc / linux-gcc (push) Failing after 53s
rpcrypto-build / build (Debug, himix200.toolchain.cmake) (push) Failing after 1m1s
rpcrypto-build / build (Release, himix200.toolchain.cmake) (push) Failing after 1m10s
linux-mips64-gcc / linux-gcc-mips64el (push) Failing after 1m10s
rpcrypto-build / build (Release, hisiv510.toolchain.cmake) (push) Failing after 1m13s
linux-hisiv500-gcc / linux-gcc-hisiv500 (push) Failing after 2m45s

This commit is contained in:
tqcq 2024-01-05 10:19:20 +08:00
parent 89cdec08cb
commit e4f61f350a
3 changed files with 13 additions and 5 deletions

View File

@ -26,11 +26,13 @@ SOFTWARE.
#define INCLUDE_INJA_INJA_HPP_
#include <nlohmann/json.hpp>
namespace inja {
#if __cplusplus < 201703L
namespace std {
#if __cplusplus <= 201103L
using string_view = const std::string &;
#endif
}// namespace std
namespace inja {
#ifndef INJA_DATA_TYPE
using json = nlohmann::json;

View File

@ -18,6 +18,7 @@
// SPDX-License-Identifier: GPL-2.0-only or commercial
// fix miss CLOCK_REALTIME
#include <time.h>
#define _POSIX_C_SOURCE 200809L
#include "mongoose.h"
#include <time.h>
@ -13549,7 +13550,10 @@ uint64_t mg_millis(void) {
#elif MG_ARCH == MG_ARCH_UNIX && defined(__APPLE__)
// Apple CLOCK_MONOTONIC_RAW is equivalent to CLOCK_BOOTTIME on linux
// Apple CLOCK_UPTIME_RAW is equivalent to CLOCK_MONOTONIC_RAW on linux
return clock_gettime_nsec_np(CLOCK_UPTIME_RAW) / 1000000;
// return clock_gettime_nsec_np(CLOCK_UPTIME_RAW) / 1000000;
struct timespec tp;
clock_gettime(CLOCK_UPTIME_RAW, &tp);
return tp.tv_sec * 1000 + tp.tv_nsec / 1000000;
#elif MG_ARCH == MG_ARCH_UNIX
struct timespec ts = {0, 0};
// See #1615 - prefer monotonic clock

View File

@ -1,5 +1,7 @@
set(CMAKE_CXX_STANDARD 98)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
add_executable(ulib_test
ulib/base/types_unittest.cpp