move SystemTime stuff into a more appropriate place

This commit is contained in:
Andrei Alexeyev 2019-05-01 07:03:22 +03:00
parent f8ef67224f
commit dcf6425a04
No known key found for this signature in database
GPG key ID: 363707CD4C7FE8A4
5 changed files with 32 additions and 16 deletions

View file

@ -14,6 +14,7 @@
#include "stage.h"
#include "player.h"
#include "version.h"
#include "util/systime.h"
/*

View file

@ -8,8 +8,9 @@
#include "taisei.h"
#include "assert.h"
#include "stringops.h"
#include <time.h>
#include "systime.h"
void get_system_time(SystemTime *systime) {
#if defined(TAISEI_BUILDCONF_HAVE_TIMESPEC)

View file

@ -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 };

View file

@ -14,6 +14,8 @@
#include <time.h>
#include <SDL.h>
#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

25
src/util/systime.h Normal file
View file

@ -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 <laochailan@web.de>.
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@alienslab.net>.
*/
#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