mirror of
https://github.com/LIV2/libnix.git
synced 2025-12-06 00:23:08 +00:00
init _timezone at startup, _timezone is a macro now
This commit is contained in:
parent
0ee387d8cb
commit
201b9bc272
@ -5,17 +5,16 @@
|
||||
#include <sys/time.h>
|
||||
|
||||
#define TimerBase DOSBase->dl_TimeReq->tr_node.io_Device
|
||||
extern long _timezone;
|
||||
|
||||
int gettimeofday(struct timeval * __restrict tv, struct timezone * __restrict tz) {
|
||||
if (tv) {
|
||||
GetSysTime(tv);
|
||||
tv->tv_sec += 60 * _timezone;
|
||||
tv->tv_sec += _timezone;
|
||||
tv->tv_sec += 252460800;
|
||||
}
|
||||
if (tz) {
|
||||
tz->tz_dsttime = 0;
|
||||
tz->tz_minuteswest = _timezone;
|
||||
tz->tz_minuteswest = _timezone / 60;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
#include <time.h>
|
||||
|
||||
extern long _timezone;
|
||||
|
||||
struct tm *localtime(const time_t *t)
|
||||
{ time_t ti=*t;
|
||||
ti-=_timezone*60;
|
||||
ti-=_timezone;
|
||||
return gmtime(&ti);
|
||||
}
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
#include <time.h>
|
||||
|
||||
extern long _timezone;
|
||||
|
||||
struct tm *localtime_r(const time_t *t, struct tm *result)
|
||||
{ time_t ti=*t;
|
||||
ti-=_timezone*60;
|
||||
ti-=_timezone;
|
||||
return gmtime_r(&ti, result);
|
||||
}
|
||||
|
||||
@ -2,13 +2,11 @@
|
||||
#include <dos/dos.h>
|
||||
#include <proto/dos.h>
|
||||
|
||||
extern long _timezone;
|
||||
|
||||
time_t time(time_t *tloc)
|
||||
{ struct DateStamp t;
|
||||
time_t ti;
|
||||
DateStamp(&t); /* Get timestamp */
|
||||
ti=((t.ds_Days+2922)*1440+t.ds_Minute+_timezone)*60+
|
||||
ti=((t.ds_Days+2922)*1440+t.ds_Minute)*60+_timezone+
|
||||
t.ds_Tick/TICKS_PER_SECOND;
|
||||
if(tloc!=NULL)
|
||||
*tloc=ti;
|
||||
|
||||
@ -10,6 +10,7 @@ stolen = $(root)/sources/amiga/misc/ArgArray.c \
|
||||
$(root)/sources/nix20/extra/strftime.c \
|
||||
$(root)/sources/nix20/stdio/stat.c \
|
||||
$(root)/sources/nix20/extra/utimes.c \
|
||||
$(root)/sources/nix20/locale/__gmtoffset.c \
|
||||
$(root)/sources/nix20/locale/setlocale.c \
|
||||
$(root)/sources/nix20/locale/localeconv.c \
|
||||
$(root)/sources/misc/swapstack.c
|
||||
@ -48,10 +48,6 @@ int execve(const char *path, char *const argv[], char *const envp[]) {
|
||||
return execv(path, argv);
|
||||
}
|
||||
|
||||
int pipe(int pipefd[2]) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
pid_t fork(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -71,9 +71,6 @@ int utimes(const char *file, const struct timeval *times) {
|
||||
modtime.tv_usec %= 1000000;
|
||||
}
|
||||
t = modtime.tv_sec;
|
||||
#if 0
|
||||
extern long _timezone;
|
||||
#endif
|
||||
t -= (2922L * SECSPERDAY); /* Datestamps start from Jan 1, 1978, unix
|
||||
time from Jan 1, 1970, i.e., 2922 days
|
||||
earlier! */
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
/* Greenwich mean time offset and daylight savings time flag
|
||||
*/
|
||||
#include <time.h>
|
||||
#include <proto/locale.h>
|
||||
#include <stabs.h>
|
||||
|
||||
long __timezone__data = 0;
|
||||
int __daylight__data = 0;
|
||||
@ -10,7 +12,16 @@ long * __timezone = &__timezone__data;
|
||||
int * __daylight = &__daylight__data;
|
||||
char **__tzname = __tzname__data;
|
||||
|
||||
|
||||
void tzset() {
|
||||
|
||||
#ifndef __KICK13__
|
||||
if (LocaleBase) {
|
||||
struct Locale * locale = OpenLocale(0);
|
||||
if (locale) {
|
||||
__timezone__data = locale->loc_GMTOffset * 60;
|
||||
CloseLocale(locale);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
ADD2INIT(tzset, -11);
|
||||
@ -24,7 +24,7 @@ static unsigned char *ctype;
|
||||
extern char *__decimalpoint;
|
||||
|
||||
/* for LC_TIME */
|
||||
long _timezone;
|
||||
extern long __timezone__data;
|
||||
//extern int _daylight;
|
||||
|
||||
struct lconv __lconv;
|
||||
@ -187,10 +187,10 @@ char *setlocale(int category, const char *name) {
|
||||
|
||||
#ifndef __KICK13__
|
||||
if (__localevec[LC_TIME - 1] != NULL)
|
||||
_timezone = __localevec[LC_TIME - 1]->loc_GMTOffset;
|
||||
__timezone__data = __localevec[LC_TIME - 1]->loc_GMTOffset * 60;
|
||||
else
|
||||
#endif
|
||||
_timezone = 0;
|
||||
__timezone__data = 0;
|
||||
|
||||
return (char *) name;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user