From f15d2c96fe94a8e9c5dd852cde721785e5ff2307 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Fri, 8 Jan 2021 23:16:54 -0500 Subject: [PATCH] remove math library for time string conversion --- lib/core/ogs-compat.h | 1 - lib/sbi/conv.c | 4 ++++ lib/sbi/meson.build | 3 --- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/ogs-compat.h b/lib/core/ogs-compat.h index 811c2e382..aa0c816f4 100644 --- a/lib/core/ogs-compat.h +++ b/lib/core/ogs-compat.h @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/sbi/conv.c b/lib/sbi/conv.c index 2622956b5..b963013bd 100644 --- a/lib/sbi/conv.c +++ b/lib/sbi/conv.c @@ -345,7 +345,11 @@ bool ogs_sbi_time_from_string(ogs_time_t *timestamp, char *str) memset(&tm, 0, sizeof(tm)); ogs_strptime(seconds, "%Y-%m-%dT%H:%M:%S%z", &tm); +#if USE_MATH usecs = (ogs_time_t)floor(atof(subsecs) * 1000000.0 + 0.5); +#else + usecs = (ogs_time_t)((atof(subsecs) * 10000000 + 5) / 10); +#endif rv = ogs_time_from_gmt(timestamp, &tm, usecs); if (rv != OGS_OK) { diff --git a/lib/sbi/meson.build b/lib/sbi/meson.build index 68819bef8..d10744d93 100644 --- a/lib/sbi/meson.build +++ b/lib/sbi/meson.build @@ -42,7 +42,6 @@ libsbi_inc = include_directories('.') sbi_cc_flags = ['-DOGS_SBI_COMPILATION'] -libm_dep = cc.find_library('m', required : true) libgnutls_dep = cc.find_library('gnutls', required : true) libnghttp2_dep = dependency('libnghttp2', version: '>=1.18.1') libmicrohttpd_dep = dependency('libmicrohttpd', version: '>=0.9.40') @@ -57,7 +56,6 @@ libsbi = library('ogssbi', libcrypt_dep, libapp_dep, libsbi_openapi_dep, - libm_dep, libgnutls_dep, libnghttp2_dep, libmicrohttpd_dep, @@ -72,7 +70,6 @@ libsbi_dep = declare_dependency( libcrypt_dep, libapp_dep, libsbi_openapi_dep, - libm_dep, libgnutls_dep, libnghttp2_dep, libmicrohttpd_dep,