From 7ee826123f88c03dba6c053e10ac82d5dd1a0dad Mon Sep 17 00:00:00 2001 From: izydorst Date: Fri, 22 Nov 2002 19:31:44 +0000 Subject: [PATCH] added _systime implementation for GEOS git-svn-id: svn://svn.cc65.org/cc65/trunk@1584 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/geos/system/Makefile | 12 ++++++++---- libsrc/geos/system/systime.c | 29 +++++++++++++++++++++++++++++ libsrc/geos/system/systime.s | 28 ---------------------------- 3 files changed, 37 insertions(+), 32 deletions(-) create mode 100644 libsrc/geos/system/systime.c delete mode 100644 libsrc/geos/system/systime.s diff --git a/libsrc/geos/system/Makefile b/libsrc/geos/system/Makefile index 4389b8eba..6c4fddc5c 100644 --- a/libsrc/geos/system/Makefile +++ b/libsrc/geos/system/Makefile @@ -7,6 +7,9 @@ %.o: %.s @$(AS) -o $@ $(AFLAGS) $< +%.o: %.c + @$(CC) $(CFLAGS) $< + @$(AS) -g -o $@ $(AFLAGS) $(*).s S_OBJS = ctype.o \ callroutine.o \ @@ -19,10 +22,11 @@ S_OBJS = ctype.o \ mainloop.o \ panic.o \ tobasic.o \ - setdevice.o \ - systime.o + setdevice.o -all: $(S_OBJS) +C_OBJS = systime.o + +all: $(C_OBJS) $(S_OBJS) clean: - @rm -f *.~ $(S_OBJS) core + @rm -f *.~ $(C_OBJS:.o=.s) $(C_OBJS) $(S_OBJS) core diff --git a/libsrc/geos/system/systime.c b/libsrc/geos/system/systime.c new file mode 100644 index 000000000..14e56641a --- /dev/null +++ b/libsrc/geos/system/systime.c @@ -0,0 +1,29 @@ + +/* + * systime.c + * + * Maciej 'YTM/Elysium' Witkowiak, 22.11.2002 + */ + +#include +#include + +time_t _systime(void) { + +struct tm currentTime; + + currentTime.tm_sec = system_date.s_seconds; + currentTime.tm_min = system_date.s_minutes; + currentTime.tm_hour = system_date.s_hour; + currentTime.tm_mday = system_date.s_day; + currentTime.tm_mon = system_date.s_month; + currentTime.tm_year = system_date.s_year; + if (system_date.s_year < 87) { + currentTime.tm_year+=100; + } + currentTime.tm_isdst = -1; + + return mktime(¤tTime); + +} + diff --git a/libsrc/geos/system/systime.s b/libsrc/geos/system/systime.s deleted file mode 100644 index 1d039e80e..000000000 --- a/libsrc/geos/system/systime.s +++ /dev/null @@ -1,28 +0,0 @@ -; -; Ullrich von Bassewitz, 12.11.2002 -; -; time_t _systime (void); -; /* Similar to time(), but: -; * - Is not ISO C -; * - Does not take the additional pointer -; * - Does not set errno when returning -1 -; */ -; - - .export __systime - - .importzp sreg - -.code - -.proc __systime - - lda #$FF - tax - sta sreg - sta sreg+1 - rts ; Return -1 - -.endproc - - -- 2.39.5