diff --git a/src/replay.h b/src/replay.h index d7c0b26d..d3911c97 100644 --- a/src/replay.h +++ b/src/replay.h @@ -14,6 +14,7 @@ #include "stage.h" #include "player.h" #include "version.h" +#include "util/systime.h" /* diff --git a/src/util/platform_posix.c b/src/util/platform_posix.c index ce18a0af..14a69c4e 100644 --- a/src/util/platform_posix.c +++ b/src/util/platform_posix.c @@ -8,8 +8,9 @@ #include "taisei.h" -#include "assert.h" -#include "stringops.h" +#include + +#include "systime.h" void get_system_time(SystemTime *systime) { #if defined(TAISEI_BUILDCONF_HAVE_TIMESPEC) diff --git a/src/util/platform_win32.c b/src/util/platform_win32.c index 6e6eac27..b0965660 100644 --- a/src/util/platform_win32.c +++ b/src/util/platform_win32.c @@ -8,8 +8,7 @@ #include "taisei.h" -#include "assert.h" -#include "stringops.h" +#include "systime.h" static time_t win32time_to_posixtime(SYSTEMTIME *wtime) { struct tm ptime = { 0 }; diff --git a/src/util/stringops.h b/src/util/stringops.h index 5af39087..4db37139 100644 --- a/src/util/stringops.h +++ b/src/util/stringops.h @@ -14,6 +14,8 @@ #include #include +#include "systime.h" + #define UNICODE_UNKNOWN 0xFFFD #define UNICODE_BOM_NATIVE 0xFEFF #define UNICODE_BOM_SWAPPED 0xFFFE @@ -70,19 +72,7 @@ uint32_t crc32str(uint32_t crc, const char *str); void format_huge_num(uint digits, uint64_t num, size_t bufsize, char *buf); void hexdigest(uint8_t *input, size_t input_size, char *output, size_t output_size); -// XXX: Not sure if this is the appropriate header for this - -#ifdef TAISEI_BUILDCONF_HAVE_TIMESPEC -typedef struct timespec SystemTime; -#else -typedef struct SystemTime { - time_t tv_sec; - long tv_nsec; -} SystemTime; -#endif - #define FILENAME_TIMESTAMP_MIN_BUF_SIZE 23 -void get_system_time(SystemTime *time) attr_nonnull(1); size_t filename_timestamp(char *buf, size_t buf_size, const SystemTime time) attr_nonnull(1); #endif // IGUARD_util_stringops_h diff --git a/src/util/systime.h b/src/util/systime.h new file mode 100644 index 00000000..9b96421a --- /dev/null +++ b/src/util/systime.h @@ -0,0 +1,25 @@ +/* + * This software is licensed under the terms of the MIT-License + * See COPYING for further information. + * --- + * Copyright (c) 2011-2019, Lukas Weber . + * Copyright (c) 2012-2019, Andrei Alexeyev . + */ + +#ifndef IGUARD_util_systime_h +#define IGUARD_util_systime_h + +#include "taisei.h" + +#ifdef TAISEI_BUILDCONF_HAVE_TIMESPEC +typedef struct timespec SystemTime; +#else +typedef struct SystemTime { + time_t tv_sec; + long tv_nsec; +} SystemTime; +#endif + +void get_system_time(SystemTime *time) attr_nonnull(1); + +#endif // IGUARD_util_systime_h