diff --git a/include/rp6502.h b/include/rp6502.h index 33e983de3..c1f60d89a 100644 --- a/include/rp6502.h +++ b/include/rp6502.h @@ -129,6 +129,10 @@ int __fastcall__ read_xram (unsigned buf, unsigned count, int fildes); int __fastcall__ write_xstack (const void* buf, unsigned count, int fildes); int __fastcall__ write_xram (unsigned buf, unsigned count, int fildes); +/* Time zone hack */ + +void ria_tzset (unsigned long time); + /* XREG location helpers */ #define xreg_ria_keyboard(...) xreg(0, 0, 0, __VA_ARGS__) diff --git a/include/time.h b/include/time.h index d320fe3f1..5eb6f144a 100644 --- a/include/time.h +++ b/include/time.h @@ -134,7 +134,6 @@ extern struct _timezone { int __fastcall__ clock_getres (clockid_t clock_id, struct timespec *res); int __fastcall__ clock_gettime (clockid_t clock_id, struct timespec *tp); int __fastcall__ clock_settime (clockid_t clock_id, const struct timespec *tp); -void tzset (void); #endif diff --git a/libsrc/rp6502/gettimezone.c b/libsrc/rp6502/gettimezone.c index f3cb2a061..86d0fefcc 100644 --- a/libsrc/rp6502/gettimezone.c +++ b/libsrc/rp6502/gettimezone.c @@ -1,10 +1,11 @@ #include #include -int clock_gettimezone (clockid_t clock_id, struct _timezone* tz) +int clock_gettimezone (time_t time, clockid_t clock_id, struct _timezone* tz) { int ax; ria_set_ax (clock_id); + ria_push_long (time); ax = ria_call_int_errno (RIA_OP_CLOCK_GETTIMEZONE); if (ax >= 0) { char i; diff --git a/libsrc/rp6502/ria_tzset.c b/libsrc/rp6502/ria_tzset.c new file mode 100644 index 000000000..3f39e44f2 --- /dev/null +++ b/libsrc/rp6502/ria_tzset.c @@ -0,0 +1,9 @@ +#include +#include + +int clock_gettimezone (time_t time, clockid_t clock_id, struct _timezone* tz); + +void ria_tzset (unsigned long time) +{ + clock_gettimezone (time, CLOCK_REALTIME, &_tz); +} diff --git a/libsrc/rp6502/sysremove.c b/libsrc/rp6502/sysremove.c index 22d2a65fc..2f1bcadbb 100644 --- a/libsrc/rp6502/sysremove.c +++ b/libsrc/rp6502/sysremove.c @@ -7,8 +7,8 @@ unsigned char __fastcall__ _sysremove (const char* name) size_t namelen; namelen = strlen (name); if (namelen > 255) { - RIA.errno = EINVAL; - return __mappederrno(RIA.errno); + RIA.errno_ = EINVAL; + return __mappederrno (RIA.errno_); } while (namelen) { ria_push_char (name[--namelen]); diff --git a/libsrc/rp6502/sysrename.c b/libsrc/rp6502/sysrename.c index e05ad725a..f61e96a1d 100644 --- a/libsrc/rp6502/sysrename.c +++ b/libsrc/rp6502/sysrename.c @@ -8,8 +8,8 @@ unsigned char __fastcall__ _sysrename (const char* oldpath, const char* newpath) oldpathlen = strlen (oldpath); newpathlen = strlen (newpath); if (oldpathlen + newpathlen > 510) { - RIA.errno = EINVAL; - return __mappederrno(RIA.errno); + RIA.errno_ = EINVAL; + return __mappederrno (RIA.errno_); } while (oldpathlen) { ria_push_char (oldpath[--oldpathlen]); diff --git a/libsrc/rp6502/tzset.c b/libsrc/rp6502/tzset.c deleted file mode 100644 index be4236f2f..000000000 --- a/libsrc/rp6502/tzset.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -int clock_gettimezone (clockid_t clock_id, struct _timezone* tz); - -void tzset (void) -{ - clock_gettimezone (CLOCK_REALTIME, &_tz); -} diff --git a/libsrc/rp6502/write_xstack.c b/libsrc/rp6502/write_xstack.c index b356ec706..1df1fd706 100644 --- a/libsrc/rp6502/write_xstack.c +++ b/libsrc/rp6502/write_xstack.c @@ -5,8 +5,8 @@ int __fastcall__ write_xstack (const void* buf, unsigned count, int fildes) { unsigned i; if (count > 512) { - RIA.errno = EINVAL; - return __mappederrno(RIA.errno); + RIA.errno_ = EINVAL; + return __mappederrno (RIA.errno_); } for (i = count; i;) { ria_push_char (((char*)buf)[--i]);