change to ria_tzset
This commit is contained in:
@@ -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_xstack (const void* buf, unsigned count, int fildes);
|
||||||
int __fastcall__ write_xram (unsigned 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 */
|
/* XREG location helpers */
|
||||||
|
|
||||||
#define xreg_ria_keyboard(...) xreg(0, 0, 0, __VA_ARGS__)
|
#define xreg_ria_keyboard(...) xreg(0, 0, 0, __VA_ARGS__)
|
||||||
|
|||||||
@@ -134,7 +134,6 @@ extern struct _timezone {
|
|||||||
int __fastcall__ clock_getres (clockid_t clock_id, struct timespec *res);
|
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_gettime (clockid_t clock_id, struct timespec *tp);
|
||||||
int __fastcall__ clock_settime (clockid_t clock_id, const struct timespec *tp);
|
int __fastcall__ clock_settime (clockid_t clock_id, const struct timespec *tp);
|
||||||
void tzset (void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
#include <rp6502.h>
|
#include <rp6502.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
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;
|
int ax;
|
||||||
ria_set_ax (clock_id);
|
ria_set_ax (clock_id);
|
||||||
|
ria_push_long (time);
|
||||||
ax = ria_call_int_errno (RIA_OP_CLOCK_GETTIMEZONE);
|
ax = ria_call_int_errno (RIA_OP_CLOCK_GETTIMEZONE);
|
||||||
if (ax >= 0) {
|
if (ax >= 0) {
|
||||||
char i;
|
char i;
|
||||||
|
|||||||
9
libsrc/rp6502/ria_tzset.c
Normal file
9
libsrc/rp6502/ria_tzset.c
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include <rp6502.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
@@ -7,8 +7,8 @@ unsigned char __fastcall__ _sysremove (const char* name)
|
|||||||
size_t namelen;
|
size_t namelen;
|
||||||
namelen = strlen (name);
|
namelen = strlen (name);
|
||||||
if (namelen > 255) {
|
if (namelen > 255) {
|
||||||
RIA.errno = EINVAL;
|
RIA.errno_ = EINVAL;
|
||||||
return __mappederrno(RIA.errno);
|
return __mappederrno (RIA.errno_);
|
||||||
}
|
}
|
||||||
while (namelen) {
|
while (namelen) {
|
||||||
ria_push_char (name[--namelen]);
|
ria_push_char (name[--namelen]);
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ unsigned char __fastcall__ _sysrename (const char* oldpath, const char* newpath)
|
|||||||
oldpathlen = strlen (oldpath);
|
oldpathlen = strlen (oldpath);
|
||||||
newpathlen = strlen (newpath);
|
newpathlen = strlen (newpath);
|
||||||
if (oldpathlen + newpathlen > 510) {
|
if (oldpathlen + newpathlen > 510) {
|
||||||
RIA.errno = EINVAL;
|
RIA.errno_ = EINVAL;
|
||||||
return __mappederrno(RIA.errno);
|
return __mappederrno (RIA.errno_);
|
||||||
}
|
}
|
||||||
while (oldpathlen) {
|
while (oldpathlen) {
|
||||||
ria_push_char (oldpath[--oldpathlen]);
|
ria_push_char (oldpath[--oldpathlen]);
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
#include <rp6502.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
int clock_gettimezone (clockid_t clock_id, struct _timezone* tz);
|
|
||||||
|
|
||||||
void tzset (void)
|
|
||||||
{
|
|
||||||
clock_gettimezone (CLOCK_REALTIME, &_tz);
|
|
||||||
}
|
|
||||||
@@ -5,8 +5,8 @@ int __fastcall__ write_xstack (const void* buf, unsigned count, int fildes)
|
|||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
if (count > 512) {
|
if (count > 512) {
|
||||||
RIA.errno = EINVAL;
|
RIA.errno_ = EINVAL;
|
||||||
return __mappederrno(RIA.errno);
|
return __mappederrno (RIA.errno_);
|
||||||
}
|
}
|
||||||
for (i = count; i;) {
|
for (i = count; i;) {
|
||||||
ria_push_char (((char*)buf)[--i]);
|
ria_push_char (((char*)buf)[--i]);
|
||||||
|
|||||||
Reference in New Issue
Block a user