Replace datime() with just time().
Also make the 'savetime' value meaningful. This removes a separate library dependency on some systems.
This commit is contained in:
parent
fb8ba08986
commit
d23111daba
4 changed files with 2 additions and 19 deletions
5
Makefile
5
Makefile
|
@ -12,11 +12,6 @@ CCFLAGS+=-std=c99 -D_DEFAULT_SOURCE -DVERSION=\"$(VERS)\" -O2
|
|||
LIBS=$(shell pkg-config --libs libedit)
|
||||
INC+=$(shell pkg-config --cflags libedit)
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
LIBS+=-lrt
|
||||
endif
|
||||
|
||||
OBJS=main.o init.o actions.o score.o misc.o saveresume.o
|
||||
CHEAT_OBJS=cheat.o init.o actions.o score.o misc.o saveresume.o
|
||||
SOURCES=$(OBJS:.o=.c) advent.h adventure.yaml Makefile control make_dungeon.py
|
||||
|
|
1
advent.h
1
advent.h
|
@ -206,7 +206,6 @@ extern long atdwrf(long);
|
|||
extern long setbit(long);
|
||||
extern bool tstbit(long, int);
|
||||
extern void make_zzword(char*);
|
||||
extern void datime(long*, long*);
|
||||
extern void set_seed(long);
|
||||
extern unsigned long get_next_lcg_value(void);
|
||||
extern long randrange(long);
|
||||
|
|
8
misc.c
8
misc.c
|
@ -680,14 +680,6 @@ void make_zzword(char zzword[6])
|
|||
zzword[5] = '\0';
|
||||
}
|
||||
|
||||
void datime(long* d, long* t)
|
||||
{
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
*d = (long) tv.tv_sec;
|
||||
*t = (long) tv.tv_usec;
|
||||
}
|
||||
|
||||
// LCOV_EXCL_START
|
||||
void bug(enum bugtype num, const char *error_string)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <editline/readline.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "advent.h"
|
||||
#include "dungeon.h"
|
||||
|
@ -31,12 +32,8 @@ struct save_t save;
|
|||
int savefile(FILE *fp, long version)
|
||||
/* Save game to file. No input or output from user. */
|
||||
{
|
||||
long i, k;
|
||||
datime(&i, &k);
|
||||
k = i + 650 * k;
|
||||
save.savetime = k;
|
||||
save.savetime = time(NULL);
|
||||
save.mode = -1;
|
||||
|
||||
save.version = (version == 0) ? VRSION : version;
|
||||
|
||||
memcpy(&save.game, &game, sizeof(struct game_t));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue