Also make the 'savetime' value meaningful.
This removes a separate library dependency on some systems.
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
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);
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)
{
#include <stdlib.h>
#include <string.h>
#include <editline/readline.h>
+#include <time.h>
#include "advent.h"
#include "dungeon.h"
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));