]> git.sur5r.net Git - cc65/commitdiff
added _systime implementation for GEOS
authorizydorst <izydorst@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 22 Nov 2002 19:31:44 +0000 (19:31 +0000)
committerizydorst <izydorst@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Fri, 22 Nov 2002 19:31:44 +0000 (19:31 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@1584 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/geos/system/Makefile
libsrc/geos/system/systime.c [new file with mode: 0644]
libsrc/geos/system/systime.s [deleted file]

index 4389b8eba6e1b71ff4c874e2c0c256da4214d4aa..6c4fddc5c93c65c35c7d668945bd1523947b5403 100644 (file)
@@ -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 (file)
index 0000000..14e5664
--- /dev/null
@@ -0,0 +1,29 @@
+
+/*
+ * systime.c
+ *
+ * Maciej 'YTM/Elysium' Witkowiak, 22.11.2002
+ */
+
+#include <time.h>
+#include <geos.h>
+
+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(&currentTime);
+
+}
+
diff --git a/libsrc/geos/system/systime.s b/libsrc/geos/system/systime.s
deleted file mode 100644 (file)
index 1d039e8..0000000
+++ /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
-
-