Version 3 changes
This commit is contained in:
parent
74189899e2
commit
a91d2be4a3
12
CONTENT
12
CONTENT
|
@ -1,6 +1,8 @@
|
|||
time.h tzset, tzalloc, tzfree, time, mktime, mktime_z, localtime, localtime_r
|
||||
localtime_rz, gmtime, gmtime_r, ctime, ctime_r, difftime, asctime,
|
||||
asctime_r, strftime, strftime_l, strptime, strptime_l, daylight_c,
|
||||
timezone_c, altzone_c, tzname_c
|
||||
time.h tzset, tzalloc, tzfree, time, mktime, mktime_z, localtime, localtime_r,
|
||||
localtime_rz, gmtime, gmtime_r, ctime, ctime_r, ctime_rz, difftime,
|
||||
offtime, offtime_r, timeoff, asctime, asctime_r, strftime, strftime_l,
|
||||
strptime, strptime_l, timegm, timelocal, timelocal_z, daylight_c,
|
||||
timezone_c, altzone_c, tzname_c, time2posix, time2posix_z, posix2time,
|
||||
posix2time_z, tzsetwall, tzgetname
|
||||
sys/time.h gettimeofday, settimeofday
|
||||
extra getsystime, setsystime, gmtoffset, tzlocation
|
||||
extra getsystime, setsystime, tzgetlocation, gmtoffset, stou, utos
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
all: date1 date2 gmtime localtime nyc strftime strftime2 strptime time
|
||||
|
||||
CC = m68k-amigaos-gcc
|
||||
CFLAGS = -O2 -noixemul -I../utility/include -Wall -Werror
|
||||
CFLAGS = -O2 -s -noixemul -I../utility/include -Wall -Werror
|
||||
LIBS =
|
||||
|
||||
date1.o: date1.c
|
||||
|
|
|
@ -1 +1 @@
|
|||
ZDump America/Argentina/Buenos_Aires America/Barbados America/Belize America/Caracas America/Chicago America/Detroit America/Grenada America/Havana America/La_Paz America/Lima America/Los_Angeles America/Mexico_City America/Nassau America/New_York America/Nome America/Puerto_Rico America/Sao_Paulo America/Thule America/Vancouver Asia/Damascus Asia/Irkutsk Asia/Karachi Asia/Samarkand Asia/Seoul Asia/Shanghai Asia/Singapore Asia/Tokyo Europe/Amsterdam Europe/Athens Europe/Lisbon Europe/London Europe/Moscow
|
||||
ZDump America/Argentina/Buenos_Aires America/Barbados America/Belize America/Caracas America/Chicago America/Detroit America/Grenada America/Havana America/La_Paz America/Lima America/Los_Angeles America/Mexico_City America/Nassau America/New_York America/Nome America/Puerto_Rico America/Sao_Paulo America/Thule America/Vancouver Asia/Damascus Asia/Irkutsk Asia/Karachi Asia/Samarkand Asia/Seoul Asia/Shanghai Asia/Singapore Asia/Tokyo Autralia/Melbourne Pacific/Noumea Pacific/Galapogos Europe/Amsterdam Europe/Athens Europe/Lisbon Europe/London Europe/Moscow
|
|
@ -26,7 +26,7 @@ int main()
|
|||
timezone = tzalloc(name);
|
||||
if (timezone != NULL) {
|
||||
localtime_rz(timezone, &rawtime, &info);
|
||||
underscore_remove(name);
|
||||
utos(name);
|
||||
printf("Time in %s is:\n", name);
|
||||
printf("%s", asctime(&info));
|
||||
tzfree(timezone);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@database tzc.guide
|
||||
@author Carsten Larsen
|
||||
@(c) Carsten Larsen
|
||||
@$VER: tz.guide 2.00 (30.07.2015)
|
||||
@$VER: tz.guide 3.00 (31.07.2015)
|
||||
@node Main "Amiga time zone database"
|
||||
@title "Amiga time zone database"
|
||||
|
||||
|
@ -268,14 +268,16 @@ proposing and distributing patches is via email as illustrated above.
|
|||
|
||||
@{b}timezone.library@{ub}
|
||||
|
||||
Version 2 of the Timezone Library implements the following functions.
|
||||
Version 3 of the Timezone Library implements the following functions.
|
||||
|
||||
time.h tzset, tzalloc, tzfree, time, mktime, mktime_z, localtime, localtime_r
|
||||
localtime_rz, gmtime, gmtime_r, ctime, ctime_r, difftime, asctime,
|
||||
asctime_r, strftime, strftime_l, strptime, strptime_l, daylight_c,
|
||||
timezone_c, altzone_c, tzname_c
|
||||
sys/time.h gettimeofday, settimeofday
|
||||
extra getsystime, setsystime, gmtoffset, tzlocation
|
||||
time.h tzset, tzalloc, tzfree, time, mktime, mktime_z, localtime, localtime_r,
|
||||
localtime_rz, gmtime, gmtime_r, ctime, ctime_r, ctime_rz, difftime,
|
||||
offtime, offtime_r, timeoff, asctime, asctime_r, strftime, strftime_l,
|
||||
strptime, strptime_l, timegm, timelocal, timelocal_z, daylight_c,
|
||||
timezone_c, altzone_c, tzname_c, time2posix, time2posix_z, posix2time,
|
||||
posix2time_z, tzsetwall, tzgetname
|
||||
sys/time.h gettimeofday, settimeofday
|
||||
extra getsystime, setsystime, tzgetlocation, gmtoffset, stou, utos
|
||||
|
||||
@endnode
|
||||
@node ZDump "ZDump user manual"
|
||||
|
|
|
@ -65,7 +65,7 @@ time_gmtload.o: time_gmtload.c time_header.h
|
|||
|
||||
time_gmtsub.o: time_gmtsub.c time_header.h
|
||||
|
||||
time_increment_ot.o: time_increment_ot.c time_header.h
|
||||
time_increment.o: time_increment.c time_header.h
|
||||
|
||||
time_init_ttinfo.o: time_init_ttinfo.c time_header.h
|
||||
|
||||
|
@ -85,6 +85,8 @@ time_mktime.o: time_mktime.c time_header.h
|
|||
|
||||
time_mktime_tzname.o: time_mktime_tzname.c time_header.h
|
||||
|
||||
time_offtime.o: time_offtime.c time_header.h
|
||||
|
||||
time_settzname.o: time_settzname.c time_header.h
|
||||
|
||||
time_state.o: time_state.c time_header.h
|
||||
|
@ -95,6 +97,14 @@ time_strptime.o: time_strptime.c time_header.h time_local.h
|
|||
|
||||
time_time.o: time_time.c time_header.h
|
||||
|
||||
time_time2posix.o: time_time2posix.c time_header.h
|
||||
|
||||
time_timegm.o: time_timegm.c time_header.h
|
||||
|
||||
time_timelocal.o: time_timelocal.c time_header.h
|
||||
|
||||
time_timeoff.o: time_timeoff.c time_header.h
|
||||
|
||||
time_timer.o: time_timer.c time_header.h
|
||||
|
||||
time_timesub.o: time_timesub.c time_header.h
|
||||
|
@ -103,9 +113,9 @@ time_tzalloc.o: time_tzalloc.c time_header.h
|
|||
|
||||
time_tzfree.o: time_tzfree.c time_header.h
|
||||
|
||||
time_tzload.o: time_tzload.c time_header.h
|
||||
time_tzgetname.o: time_tzgetname.c time_header.h
|
||||
|
||||
time_tzlocation.o: time_tzlocation.c time_header.h
|
||||
time_tzload.o: time_tzload.c time_header.h
|
||||
|
||||
time_tzparse.o: time_tzparse.c time_header.h time_rule.h
|
||||
|
||||
|
@ -115,22 +125,22 @@ time_tzset_unlock.o: time_tzset_unlock.c time_header.h
|
|||
|
||||
time_tzsetlcl.o: time_tzsetlcl.c time_header.h
|
||||
|
||||
time_updata_tzname_etc.o: time_updata_tzname_etc.c time_header.h
|
||||
time_update_tzname.o: time_update_tzname.c time_header.h
|
||||
|
||||
time_zoneinit.o: time_zoneinit.c time_header.h
|
||||
|
||||
|
||||
lib: timezone.library timezone.library.debug
|
||||
|
||||
timezone.library: ctype_isdigit.o ctype_isspace.o ctype_toupper.o lib_base.o lib_user.o string_bcopy.o string_memcpy.o string_memmove.o string_strcat.o string_strchr.o string_strcmp.o string_strcpy.o string_strlen.o string_strncmp.o strings_strncasecmp.o time_asctime.o time_ctime.o time_difftime.o time_gmtcheck.o time_gmtime.o time_gmtload.o time_gmtsub.o time_increment_ot.o time_init_ttinfo.o time_length.o time_local.o time_localsub.o time_localtime.o time_localtime_tzset.o time_lock.o time_mktime.o time_mktime_tzname.o time_settzname.o time_state.o time_strftime.o time_strptime.o time_time.o time_timer.o time_timesub.o time_tzalloc.o time_tzfree.o time_tzload.o time_tzlocation.o time_tzparse.o time_tzset.o time_tzset_unlock.o time_tzsetlcl.o time_updata_tzname_etc.o time_zoneinit.o
|
||||
$(CC) -o $@ ctype_isdigit.o ctype_isspace.o ctype_toupper.o lib_base.o lib_user.o string_bcopy.o string_memcpy.o string_memmove.o string_strcat.o string_strchr.o string_strcmp.o string_strcpy.o string_strlen.o string_strncmp.o strings_strncasecmp.o time_asctime.o time_ctime.o time_difftime.o time_gmtcheck.o time_gmtime.o time_gmtload.o time_gmtsub.o time_increment_ot.o time_init_ttinfo.o time_length.o time_local.o time_localsub.o time_localtime.o time_localtime_tzset.o time_lock.o time_mktime.o time_mktime_tzname.o time_settzname.o time_state.o time_strftime.o time_strptime.o time_time.o time_timer.o time_timesub.o time_tzalloc.o time_tzfree.o time_tzload.o time_tzlocation.o time_tzparse.o time_tzset.o time_tzset_unlock.o time_tzsetlcl.o time_updata_tzname_etc.o time_zoneinit.o $(CFLAGS) -s -nostartfiles -nostdlib ${LDLIBS}
|
||||
timezone.library: ctype_isdigit.o ctype_isspace.o ctype_toupper.o lib_base.o lib_user.o string_bcopy.o string_memcpy.o string_memmove.o string_strcat.o string_strchr.o string_strcmp.o string_strcpy.o string_strlen.o string_strncmp.o strings_strncasecmp.o time_asctime.o time_ctime.o time_difftime.o time_gmtcheck.o time_gmtime.o time_gmtload.o time_gmtsub.o time_increment.o time_init_ttinfo.o time_length.o time_local.o time_localsub.o time_localtime.o time_localtime_tzset.o time_lock.o time_mktime.o time_mktime_tzname.o time_offtime.o time_settzname.o time_state.o time_strftime.o time_strptime.o time_time.o time_time2posix.o time_timegm.o time_timelocal.o time_timeoff.o time_timer.o time_timesub.o time_tzalloc.o time_tzfree.o time_tzgetname.o time_tzload.o time_tzparse.o time_tzset.o time_tzset_unlock.o time_tzsetlcl.o time_update_tzname.o time_zoneinit.o
|
||||
$(CC) -o $@ ctype_isdigit.o ctype_isspace.o ctype_toupper.o lib_base.o lib_user.o string_bcopy.o string_memcpy.o string_memmove.o string_strcat.o string_strchr.o string_strcmp.o string_strcpy.o string_strlen.o string_strncmp.o strings_strncasecmp.o time_asctime.o time_ctime.o time_difftime.o time_gmtcheck.o time_gmtime.o time_gmtload.o time_gmtsub.o time_increment.o time_init_ttinfo.o time_length.o time_local.o time_localsub.o time_localtime.o time_localtime_tzset.o time_lock.o time_mktime.o time_mktime_tzname.o time_offtime.o time_settzname.o time_state.o time_strftime.o time_strptime.o time_time.o time_time2posix.o time_timegm.o time_timelocal.o time_timeoff.o time_timer.o time_timesub.o time_tzalloc.o time_tzfree.o time_tzgetname.o time_tzload.o time_tzparse.o time_tzset.o time_tzset_unlock.o time_tzsetlcl.o time_update_tzname.o time_zoneinit.o $(CFLAGS) -s -nostartfiles -nostdlib ${LDLIBS}
|
||||
|
||||
timezone.library.debug: ctype_isdigit.o ctype_isspace.o ctype_toupper.o lib_base.o lib_user.o string_bcopy.o string_memcpy.o string_memmove.o string_strcat.o string_strchr.o string_strcmp.o string_strcpy.o string_strlen.o string_strncmp.o strings_strncasecmp.o time_asctime.o time_ctime.o time_difftime.o time_gmtcheck.o time_gmtime.o time_gmtload.o time_gmtsub.o time_increment_ot.o time_init_ttinfo.o time_length.o time_local.o time_localsub.o time_localtime.o time_localtime_tzset.o time_lock.o time_mktime.o time_mktime_tzname.o time_settzname.o time_state.o time_strftime.o time_strptime.o time_time.o time_timer.o time_timesub.o time_tzalloc.o time_tzfree.o time_tzload.o time_tzlocation.o time_tzparse.o time_tzset.o time_tzset_unlock.o time_tzsetlcl.o time_updata_tzname_etc.o time_zoneinit.o
|
||||
$(CC) -o $@ ctype_isdigit.o ctype_isspace.o ctype_toupper.o lib_base.o lib_user.o string_bcopy.o string_memcpy.o string_memmove.o string_strcat.o string_strchr.o string_strcmp.o string_strcpy.o string_strlen.o string_strncmp.o strings_strncasecmp.o time_asctime.o time_ctime.o time_difftime.o time_gmtcheck.o time_gmtime.o time_gmtload.o time_gmtsub.o time_increment_ot.o time_init_ttinfo.o time_length.o time_local.o time_localsub.o time_localtime.o time_localtime_tzset.o time_lock.o time_mktime.o time_mktime_tzname.o time_settzname.o time_state.o time_strftime.o time_strptime.o time_time.o time_timer.o time_timesub.o time_tzalloc.o time_tzfree.o time_tzload.o time_tzlocation.o time_tzparse.o time_tzset.o time_tzset_unlock.o time_tzsetlcl.o time_updata_tzname_etc.o time_zoneinit.o $(CFLAGS) \
|
||||
timezone.library.debug: ctype_isdigit.o ctype_isspace.o ctype_toupper.o lib_base.o lib_user.o string_bcopy.o string_memcpy.o string_memmove.o string_strcat.o string_strchr.o string_strcmp.o string_strcpy.o string_strlen.o string_strncmp.o strings_strncasecmp.o time_asctime.o time_ctime.o time_difftime.o time_gmtcheck.o time_gmtime.o time_gmtload.o time_gmtsub.o time_increment.o time_init_ttinfo.o time_length.o time_local.o time_localsub.o time_localtime.o time_localtime_tzset.o time_lock.o time_mktime.o time_mktime_tzname.o time_offtime.o time_settzname.o time_state.o time_strftime.o time_strptime.o time_time.o time_time2posix.o time_timegm.o time_timelocal.o time_timeoff.o time_timer.o time_timesub.o time_tzalloc.o time_tzfree.o time_tzgetname.o time_tzload.o time_tzparse.o time_tzset.o time_tzset_unlock.o time_tzsetlcl.o time_update_tzname.o time_zoneinit.o
|
||||
$(CC) -o $@ ctype_isdigit.o ctype_isspace.o ctype_toupper.o lib_base.o lib_user.o string_bcopy.o string_memcpy.o string_memmove.o string_strcat.o string_strchr.o string_strcmp.o string_strcpy.o string_strlen.o string_strncmp.o strings_strncasecmp.o time_asctime.o time_ctime.o time_difftime.o time_gmtcheck.o time_gmtime.o time_gmtload.o time_gmtsub.o time_increment.o time_init_ttinfo.o time_length.o time_local.o time_localsub.o time_localtime.o time_localtime_tzset.o time_lock.o time_mktime.o time_mktime_tzname.o time_offtime.o time_settzname.o time_state.o time_strftime.o time_strptime.o time_time.o time_time2posix.o time_timegm.o time_timelocal.o time_timeoff.o time_timer.o time_timesub.o time_tzalloc.o time_tzfree.o time_tzgetname.o time_tzload.o time_tzparse.o time_tzset.o time_tzset_unlock.o time_tzsetlcl.o time_update_tzname.o time_zoneinit.o $(CFLAGS) \
|
||||
-Wl,--cref,-M,-Map=timezone.library.map -nostartfiles -nostdlib ${LDLIBS}
|
||||
|
||||
clean:
|
||||
rm -f ctype_isdigit.o ctype_isspace.o ctype_toupper.o lib_base.o lib_user.o string_bcopy.o string_memcpy.o string_memmove.o string_strcat.o string_strchr.o string_strcmp.o string_strcpy.o string_strlen.o string_strncmp.o strings_strncasecmp.o time_asctime.o time_ctime.o time_difftime.o time_gmtcheck.o time_gmtime.o time_gmtload.o time_gmtsub.o time_increment_ot.o time_init_ttinfo.o time_length.o time_local.o time_localsub.o time_localtime.o time_localtime_tzset.o time_lock.o time_mktime.o time_mktime_tzname.o time_settzname.o time_state.o time_strftime.o time_strptime.o time_time.o time_timer.o time_timesub.o time_tzalloc.o time_tzfree.o time_tzload.o time_tzlocation.o time_tzparse.o time_tzset.o time_tzset_unlock.o time_tzsetlcl.o time_updata_tzname_etc.o time_zoneinit.o timezone.library timezone.library.debug timezone.library.map
|
||||
rm -f ctype_isdigit.o ctype_isspace.o ctype_toupper.o lib_base.o lib_user.o string_bcopy.o string_memcpy.o string_memmove.o string_strcat.o string_strchr.o string_strcmp.o string_strcpy.o string_strlen.o string_strncmp.o strings_strncasecmp.o time_asctime.o time_ctime.o time_difftime.o time_gmtcheck.o time_gmtime.o time_gmtload.o time_gmtsub.o time_increment.o time_init_ttinfo.o time_length.o time_local.o time_localsub.o time_localtime.o time_localtime_tzset.o time_lock.o time_mktime.o time_mktime_tzname.o time_offtime.o time_settzname.o time_state.o time_strftime.o time_strptime.o time_time.o time_time2posix.o time_timegm.o time_timelocal.o time_timeoff.o time_timer.o time_timesub.o time_tzalloc.o time_tzfree.o time_tzgetname.o time_tzload.o time_tzparse.o time_tzset.o time_tzset_unlock.o time_tzsetlcl.o time_update_tzname.o time_zoneinit.o timezone.library timezone.library.debug timezone.library.map
|
||||
|
||||
depend:
|
||||
@echo Dependencies already done
|
||||
|
|
|
@ -64,7 +64,7 @@ SRCS='
|
|||
time_gmtime.c
|
||||
time_gmtload.c
|
||||
time_gmtsub.c
|
||||
time_increment_ot.c
|
||||
time_increment.c
|
||||
time_init_ttinfo.c
|
||||
time_length.c
|
||||
time_local.c
|
||||
|
@ -74,22 +74,27 @@ SRCS='
|
|||
time_lock.c
|
||||
time_mktime.c
|
||||
time_mktime_tzname.c
|
||||
time_offtime.c
|
||||
time_settzname.c
|
||||
time_state.c
|
||||
time_strftime.c
|
||||
time_strptime.c
|
||||
time_time.c
|
||||
time_time2posix.c
|
||||
time_timegm.c
|
||||
time_timelocal.c
|
||||
time_timeoff.c
|
||||
time_timer.c
|
||||
time_timesub.c
|
||||
time_tzalloc.c
|
||||
time_tzfree.c
|
||||
time_tzgetname.c
|
||||
time_tzload.c
|
||||
time_tzlocation.c
|
||||
time_tzparse.c
|
||||
time_tzset.c
|
||||
time_tzset_unlock.c
|
||||
time_tzsetlcl.c
|
||||
time_updata_tzname_etc.c
|
||||
time_update_tzname.c
|
||||
time_zoneinit.c
|
||||
'
|
||||
|
||||
|
|
|
@ -6,12 +6,16 @@ time_t mktime(struct tm *tmp);
|
|||
time_t mktime_z(const timezone_t tz, struct tm *tmp);
|
||||
struct tm* localtime(const time_t *const timep);
|
||||
struct tm* localtime_r(const time_t *const timep, struct tm *tmp);
|
||||
struct tm* localtime_rz(timezone_t tz, time_t const *timep, struct tm *tmp);
|
||||
struct tm* localtime_rz(const timezone_t tz, const time_t *const timep, struct tm *tmp);
|
||||
struct tm* gmtime(const time_t *timep);
|
||||
struct tm* gmtime_r(const time_t *timep, struct tm *tmp);
|
||||
char* ctime(const time_t *const timep);
|
||||
char* ctime_r(const time_t *const timep, char *buf);
|
||||
char *ctime_rz(const timezone_t tz, const time_t *timep, char *buf);
|
||||
double difftime(const time_t time1, const time_t time0);
|
||||
struct tm *offtime(const time_t *timep, long offset);
|
||||
struct tm *offtime_r(const time_t *timep, long offset, struct tm *tmp);
|
||||
time_t timeoff(struct tm *tmp, long offset);
|
||||
char* asctime(const struct tm *timeptr);
|
||||
char* asctime_r(const struct tm *timeptr, char *buf);
|
||||
size_t strftime(char *const s, size_t maxsize,
|
||||
|
@ -22,16 +26,24 @@ size_t strftime_l(char *const s, size_t maxsize,
|
|||
char* strptime(const char *const buf, const char *const format, struct tm *const t);
|
||||
char* strptime_l(const char *const buf, const char *const format, struct tm *const t,
|
||||
locale_t locale);
|
||||
|
||||
time_t timegm(struct tm *tmp);
|
||||
time_t timelocal(struct tm *tmp);
|
||||
time_t timelocal_z(const timezone_t tz, struct tm *tmp);
|
||||
int daylight_c();
|
||||
long timezone_c();
|
||||
long altzone_c();
|
||||
char** tzname_c();
|
||||
const char *tzgetname(const timezone_t tz, int isdst);
|
||||
void tzsetwall(void);
|
||||
time_t time2posix(time_t t);
|
||||
time_t time2posix_z(const timezone_t tz, time_t t);
|
||||
time_t posix2time(time_t t);
|
||||
time_t posix2time_z(const timezone_t tz, time_t t);
|
||||
int getsystime(struct timeval *tv);
|
||||
int setsystime(struct timeval *tv);
|
||||
int gettimeofday(struct timeval *tv, const timezone_t tz);
|
||||
int settimeofday(const struct timeval *tv, const timezone_t tz);
|
||||
int gmtoffset(time_t tloc);
|
||||
char* tzlocation(void);
|
||||
void underscore_add(char *s);
|
||||
void underscore_remove(char *s);
|
||||
const char* tzgetlocation(void);
|
||||
void stou(char *s);
|
||||
void utos(char *s);
|
||||
|
|
|
@ -14,23 +14,36 @@ gmtime(timep)(a0)
|
|||
gmtime_r(timep,tm0)(a0/a1)
|
||||
ctime(timep)(a0)
|
||||
ctime_r(timep,buf)(a0/a1)
|
||||
ctime_rz(tz,timep,buf)(a2/a0/a1)
|
||||
difftime(time1,time0)(d1/d0)
|
||||
offtime(timep,offset)(a0,d0)
|
||||
offtime_r(timep,offset,tmp)(a0,d0,a1)
|
||||
timeoff(tmp,offset)(a0,d0)
|
||||
asctime(timeptr)(a0)
|
||||
asctime_r(timeptr,buf)(a0/a1)
|
||||
strftime(s,maxsize,format,t)(a0,d0,a1/a2)
|
||||
strftime_l(s,maxsize,format,t,locale)(a0,d0,a1/a2/a3)
|
||||
strptime(buf,format,t)(a0/a1/a2)
|
||||
strptime_l(buf,format,t,locale)(a0/a1/a2/a3)
|
||||
timegm(tmp)(a0)
|
||||
timelocal(tmp)(a0)
|
||||
timelocal_z(tz,tmp)(a1/a0)
|
||||
daylight_c()()
|
||||
timezone_c()()
|
||||
altzone_c()()
|
||||
tzname_c()()
|
||||
time2posix(t)(d0)
|
||||
time2posix_z(tz,t)(a0,d0)
|
||||
posix2time(t)(d0)
|
||||
posix2time_z(tz,t)(a0,d0)
|
||||
getsystime(tv)(a0)
|
||||
setsystime(tv)(a0)
|
||||
gettimeofday(tv,tz)(a0/a1)
|
||||
settimeofday(tv,tz)(a0/a1)
|
||||
tzsetwall()()
|
||||
tzgetname(tz,isdst)(a0,d0)
|
||||
tzgetlocation()()
|
||||
gmtoffset(tloc)(d0)
|
||||
tzlocation()()
|
||||
underscore_add(s)(a0)
|
||||
underscore_remove(s)(a0)
|
||||
stou(s)(a0)
|
||||
utos(s)(a0)
|
||||
##end
|
||||
|
|
|
@ -379,25 +379,38 @@ STATIC CONST APTR main_vectors[]=
|
|||
gmtime_r,
|
||||
ctime,
|
||||
ctime_r,
|
||||
ctime_rz,
|
||||
difftime,
|
||||
offtime,
|
||||
offtime_r,
|
||||
timeoff,
|
||||
asctime,
|
||||
asctime_r,
|
||||
strftime,
|
||||
strftime_l,
|
||||
strptime,
|
||||
strptime_l,
|
||||
timegm,
|
||||
timelocal,
|
||||
timelocal_z,
|
||||
daylight_c,
|
||||
timezone_c,
|
||||
altzone_c,
|
||||
tzname_c,
|
||||
time2posix,
|
||||
time2posix_z,
|
||||
posix2time,
|
||||
posix2time_z,
|
||||
getsystime,
|
||||
setsystime,
|
||||
gettimeofday,
|
||||
settimeofday,
|
||||
tzsetwall,
|
||||
tzgetname,
|
||||
tzgetlocation,
|
||||
gmtoffset,
|
||||
tzlocation,
|
||||
underscore_add,
|
||||
underscore_remove,
|
||||
stou,
|
||||
utos,
|
||||
|
||||
(APTR)-1
|
||||
};
|
||||
|
@ -505,25 +518,38 @@ STATIC CONST APTR lib_vectors[] =
|
|||
gmtime_r,
|
||||
ctime,
|
||||
ctime_r,
|
||||
ctime_rz,
|
||||
difftime,
|
||||
offtime,
|
||||
offtime_r,
|
||||
timeoff,
|
||||
asctime,
|
||||
asctime_r,
|
||||
strftime,
|
||||
strftime_l,
|
||||
strptime,
|
||||
strptime_l,
|
||||
timegm,
|
||||
timelocal,
|
||||
timelocal_z,
|
||||
daylight_c,
|
||||
timezone_c,
|
||||
altzone_c,
|
||||
tzname_c,
|
||||
time2posix,
|
||||
time2posix_z,
|
||||
posix2time,
|
||||
posix2time_z,
|
||||
getsystime,
|
||||
setsystime,
|
||||
gettimeofday,
|
||||
settimeofday,
|
||||
tzsetwall,
|
||||
tzgetname,
|
||||
tzgetlocation,
|
||||
gmtoffset,
|
||||
tzlocation,
|
||||
underscore_add,
|
||||
underscore_remove,
|
||||
stou,
|
||||
utos,
|
||||
|
||||
(APTR) -1
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//--------------------------------------------------------------------------//
|
||||
|
||||
#include "time_header.h"
|
||||
#include "time_local.h"
|
||||
|
||||
#define STD_ASCTIME_BUF_SIZE 26
|
||||
#define MAX_ASCTIME_BUF_SIZE 64
|
||||
|
@ -27,15 +28,6 @@ char* ASM asctime_r(
|
|||
REG(a1, char *buf)
|
||||
)
|
||||
{
|
||||
static const char wday_name[][3] = {
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||
};
|
||||
|
||||
static const char mon_name[][3] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
||||
static const char *fmt1 = "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %-4s\n";
|
||||
static const char *fmt2 = "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %s\n";
|
||||
|
||||
|
@ -51,12 +43,12 @@ char* ASM asctime_r(
|
|||
if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK)
|
||||
out.wn = "???";
|
||||
else
|
||||
out.wn = wday_name[timeptr->tm_wday];
|
||||
out.wn = C_time_locale.wday[timeptr->tm_wday];
|
||||
|
||||
if (timeptr->tm_mon < 0 || timeptr->tm_mon >= MONSPERYEAR)
|
||||
out.mn = "???";
|
||||
else
|
||||
out.mn = mon_name[timeptr->tm_mon];
|
||||
out.mn = C_time_locale.mon[timeptr->tm_mon];
|
||||
|
||||
strftime(year, 6, "%Y", timeptr);
|
||||
|
||||
|
|
|
@ -30,3 +30,17 @@ char* ASM ctime_r(
|
|||
struct tm *tmp = localtime_r(timep, &tm);
|
||||
return tmp ? asctime_r(&tm, buf) : NULL;
|
||||
}
|
||||
|
||||
char* ASM ctime_rz(
|
||||
REG(a2, const timezone_t tz),
|
||||
REG(a0, const time_t *const timep),
|
||||
REG(a1, char *buf)
|
||||
)
|
||||
{
|
||||
struct tm mytm, *rtm;
|
||||
|
||||
rtm = localtime_rz(tz, timep, &mytm);
|
||||
if (rtm == NULL)
|
||||
return NULL;
|
||||
return asctime_r(rtm, buf);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "time_length.h"
|
||||
#include "time_tzfile.h"
|
||||
|
||||
void ASM tzset(void);
|
||||
void tzset(void);
|
||||
|
||||
timezone_t ASM tzalloc(
|
||||
REG(a0, char const *name)
|
||||
|
@ -47,7 +47,7 @@ struct tm* ASM localtime_r(
|
|||
|
||||
struct tm* ASM localtime_rz(
|
||||
REG(a2, timezone_t tz),
|
||||
REG(a0, time_t const *timep),
|
||||
REG(a0, const time_t *const timep),
|
||||
REG(a1, struct tm *tmp)
|
||||
);
|
||||
|
||||
|
@ -60,6 +60,40 @@ struct tm* ASM gmtime_r(
|
|||
REG(a1, struct tm *tmp)
|
||||
);
|
||||
|
||||
time_t ASM timegm(
|
||||
REG(a0, struct tm *const tmp)
|
||||
);
|
||||
|
||||
time_t ASM timelocal(
|
||||
REG(a0, struct tm *const tmp)
|
||||
);
|
||||
|
||||
time_t ASM timelocal_z(
|
||||
REG(a1, const timezone_t tz),
|
||||
REG(a0, struct tm *const tmp)
|
||||
);
|
||||
|
||||
double ASM difftime(
|
||||
REG(d1, const time_t time1),
|
||||
REG(d0, const time_t time0)
|
||||
);
|
||||
|
||||
struct tm* ASM offtime(
|
||||
REG(a0, const time_t *const timep),
|
||||
REG(d0, long offset)
|
||||
);
|
||||
|
||||
struct tm* ASM offtime_r(
|
||||
REG(a0, const time_t *timep),
|
||||
REG(d0, long offset),
|
||||
REG(a1, struct tm *tmp)
|
||||
);
|
||||
|
||||
time_t ASM timeoff(
|
||||
REG(a0, struct tm *const tmp),
|
||||
REG(d0, long offset)
|
||||
);
|
||||
|
||||
char* ASM ctime(
|
||||
REG(a0, const time_t *const timep)
|
||||
);
|
||||
|
@ -69,9 +103,10 @@ char* ASM ctime_r(
|
|||
REG(a1, char *buf)
|
||||
);
|
||||
|
||||
double ASM difftime(
|
||||
REG(d1, const time_t time1),
|
||||
REG(d0, const time_t time0)
|
||||
char* ASM ctime_rz(
|
||||
REG(a2, const timezone_t tz),
|
||||
REG(a0, const time_t *const timep),
|
||||
REG(a1, char *buf)
|
||||
);
|
||||
|
||||
char* ASM asctime(
|
||||
|
@ -111,6 +146,24 @@ char* ASM strptime_l(
|
|||
REG(a3, locale_t locale)
|
||||
);
|
||||
|
||||
time_t ASM time2posix(
|
||||
REG(d0, time_t t)
|
||||
);
|
||||
|
||||
time_t ASM time2posix_z(
|
||||
REG(a0, timezone_t tz),
|
||||
REG(d0, time_t t)
|
||||
);
|
||||
|
||||
time_t ASM posix2time(
|
||||
REG(d0, time_t t)
|
||||
);
|
||||
|
||||
time_t ASM posix2time_z(
|
||||
REG(a0, timezone_t tz),
|
||||
REG(d0, time_t t)
|
||||
);
|
||||
|
||||
int ASM daylight_c(void);
|
||||
long ASM timezone_c(void);
|
||||
long ASM altzone_c(void);
|
||||
|
@ -138,13 +191,20 @@ int ASM gmtoffset(
|
|||
REG(d0, time_t locale_time)
|
||||
);
|
||||
|
||||
char* ASM tzlocation(void);
|
||||
void tzsetwall(void);
|
||||
|
||||
void ASM underscore_add(
|
||||
const char* ASM tzgetlocation(void);
|
||||
|
||||
const char* ASM tzgetname(
|
||||
REG(a0, const timezone_t tz),
|
||||
REG(d0, int isdst)
|
||||
);
|
||||
|
||||
void ASM stou(
|
||||
REG(a0, char *s)
|
||||
);
|
||||
|
||||
void ASM underscore_remove(
|
||||
void ASM utos(
|
||||
REG(a0, char *s)
|
||||
);
|
||||
|
||||
|
@ -162,7 +222,7 @@ void settzname(void);
|
|||
void tzsetlcl(char const *name);
|
||||
void tzset_unlocked(void);
|
||||
void init_ttinfo(struct ttinfo *s, int_fast32_t gmtoff, bool isdst, int abbrind);
|
||||
void update_tzname_etc(struct state const *sp, struct ttinfo const *ttisp);
|
||||
void update_tzname(struct state const *sp, struct ttinfo const *ttisp);
|
||||
|
||||
void gmtcheck(void);
|
||||
void gmtload(struct state *const sp);
|
||||
|
@ -192,6 +252,14 @@ struct tm * localsub(
|
|||
struct tm* const tmp
|
||||
);
|
||||
|
||||
time_t time1(
|
||||
struct tm *const tmp,
|
||||
struct tm *(*funcp) (struct state const *,
|
||||
time_t const *,
|
||||
int_fast32_t, struct tm *),
|
||||
struct state const *sp,
|
||||
const int_fast32_t offset);
|
||||
|
||||
bool CreateTimer();
|
||||
void DeleteTimer();
|
||||
extern struct Device* TimerBase;
|
||||
|
|
|
@ -104,7 +104,7 @@ struct tm * localsub(
|
|||
result->tm_zone = (char *) &sp->chars[ttisp->tt_abbrind];
|
||||
|
||||
if (setname) {
|
||||
update_tzname_etc(sp, ttisp);
|
||||
update_tzname(sp, ttisp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,10 +21,9 @@ struct tm* ASM localtime_r(
|
|||
}
|
||||
|
||||
struct tm* ASM localtime_rz(
|
||||
REG(a2, struct state *tz),
|
||||
REG(a0, time_t const *timep),
|
||||
REG(a2, timezone_t tz),
|
||||
REG(a0, const time_t *const timep),
|
||||
REG(a1, struct tm *tmp))
|
||||
{
|
||||
return localsub(tz, timep, 0, tmp);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ time_t ASM mktime(
|
|||
|
||||
|
||||
time_t ASM mktime_z(
|
||||
REG(a1, struct state *sp),
|
||||
REG(a1, timezone_t tz),
|
||||
REG(a0, struct tm *tmp)
|
||||
)
|
||||
{
|
||||
return mktime_tzname(sp, tmp, false);
|
||||
return mktime_tzname(tz, tmp, false);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
//--------------------------------------------------------------------------//
|
||||
// This file is in the public domain, so clarified as of //
|
||||
// 2009-05-17 by Arthur David Olson. //
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#include "time_header.h"
|
||||
|
||||
static struct tm tm;
|
||||
|
||||
struct tm* ASM offtime(
|
||||
REG(a0, const time_t *const timep),
|
||||
REG(d0, long offset)
|
||||
)
|
||||
{
|
||||
struct tm *tmp;
|
||||
|
||||
if ((offset > 0 && offset > INT_FAST32_MAX) ||
|
||||
(offset < 0 && offset < INT_FAST32_MIN)) {
|
||||
errno = EOVERFLOW;
|
||||
return NULL;
|
||||
}
|
||||
tmp = gmtsub(NULL, timep, (int_fast32_t)offset, &tm);
|
||||
|
||||
if (tmp == NULL)
|
||||
errno = EOVERFLOW;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
struct tm* ASM offtime_r(
|
||||
REG(a0, const time_t *timep),
|
||||
REG(d0, long offset),
|
||||
REG(a1, struct tm *tmp)
|
||||
)
|
||||
{
|
||||
if ((offset > 0 && offset > INT_FAST32_MAX) ||
|
||||
(offset < 0 && offset < INT_FAST32_MIN)) {
|
||||
errno = EOVERFLOW;
|
||||
return NULL;
|
||||
}
|
||||
tmp = gmtsub(NULL, timep, (int_fast32_t)offset, tmp);
|
||||
|
||||
if (tmp == NULL)
|
||||
errno = EOVERFLOW;
|
||||
|
||||
return tmp;
|
||||
}
|
|
@ -26,12 +26,12 @@ void settzname(void)
|
|||
*/
|
||||
for (i = 0; i < sp->typecnt; ++i) {
|
||||
const struct ttinfo * const ttisp = &sp->ttis[i];
|
||||
update_tzname_etc(sp, ttisp);
|
||||
update_tzname(sp, ttisp);
|
||||
}
|
||||
|
||||
for (i = 0; i < sp->timecnt; ++i) {
|
||||
const struct ttinfo * const ttisp = &sp->ttis[sp->types[i]];
|
||||
update_tzname_etc(sp, ttisp);
|
||||
update_tzname(sp, ttisp);
|
||||
|
||||
if (ttisp->tt_isdst)
|
||||
daylight = 1;
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
//--------------------------------------------------------------------------//
|
||||
// This file is in the public domain, so clarified as of //
|
||||
// 2009-05-17 by Arthur David Olson. //
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#include "time_header.h"
|
||||
|
||||
/*
|
||||
* IEEE Std 1003.1-1988 (POSIX) legislates that 536457599
|
||||
* shall correspond to "Wed Dec 31 23:59:59 UTC 1986", which
|
||||
* is not the case if we are accounting for leap seconds.
|
||||
* So, we provide the following conversion routines for use
|
||||
* when exchanging timestamps with POSIX conforming systems.
|
||||
*
|
||||
*/
|
||||
|
||||
static int_fast64_t
|
||||
leapcorr(struct state const *sp, time_t t)
|
||||
{
|
||||
register struct lsinfo const *lp;
|
||||
register int i;
|
||||
|
||||
i = sp->leapcnt;
|
||||
while (--i >= 0) {
|
||||
lp = &sp->lsis[i];
|
||||
if (t >= lp->ls_trans)
|
||||
return lp->ls_corr;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
time_t ASM time2posix_z(
|
||||
REG(a0, struct state *sp),
|
||||
REG(d0, time_t t)
|
||||
)
|
||||
{
|
||||
return t - leapcorr(sp, t);
|
||||
}
|
||||
|
||||
time_t ASM time2posix(
|
||||
REG(d0, time_t t)
|
||||
)
|
||||
{
|
||||
int err = lock();
|
||||
|
||||
if (err) {
|
||||
errno = err;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!lcl_is_set)
|
||||
tzset_unlocked();
|
||||
if (lclptr)
|
||||
t = time2posix_z(lclptr, t);
|
||||
|
||||
unlock();
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
time_t ASM posix2time_z(
|
||||
REG(a0, struct state *sp),
|
||||
REG(d0, time_t t)
|
||||
)
|
||||
{
|
||||
time_t x;
|
||||
time_t y;
|
||||
|
||||
/*
|
||||
** For a positive leap second hit, the result
|
||||
** is not unique. For a negative leap second
|
||||
** hit, the corresponding time doesn't exist,
|
||||
** so we return an adjacent second.
|
||||
*/
|
||||
x = t + leapcorr(sp, t);
|
||||
y = x - leapcorr(sp, x);
|
||||
|
||||
if (y < t) {
|
||||
do {
|
||||
x++;
|
||||
y = x - leapcorr(sp, x);
|
||||
} while (y < t);
|
||||
x -= y != t;
|
||||
} else if (y > t) {
|
||||
do {
|
||||
--x;
|
||||
y = x - leapcorr(sp, x);
|
||||
} while (y > t);
|
||||
x += y != t;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
time_t ASM posix2time(
|
||||
REG(d0, time_t t)
|
||||
)
|
||||
{
|
||||
int err = lock();
|
||||
|
||||
if (err) {
|
||||
errno = err;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!lcl_is_set)
|
||||
tzset_unlocked();
|
||||
if (lclptr)
|
||||
t = posix2time_z(lclptr, t);
|
||||
unlock();
|
||||
|
||||
return t;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
//--------------------------------------------------------------------------//
|
||||
// This file is in the public domain, so clarified as of //
|
||||
// 2009-05-17 by Arthur David Olson. //
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#include "time_header.h"
|
||||
|
||||
time_t ASM timegm(
|
||||
REG(a0, struct tm *const tmp)
|
||||
)
|
||||
{
|
||||
time_t t;
|
||||
|
||||
if (tmp != NULL)
|
||||
tmp->tm_isdst = 0;
|
||||
t = time1(tmp, gmtsub, gmtptr, 0);
|
||||
return t;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
//--------------------------------------------------------------------------//
|
||||
// This file is in the public domain, so clarified as of //
|
||||
// 2009-05-17 by Arthur David Olson. //
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#include "time_header.h"
|
||||
|
||||
time_t ASM timelocal(
|
||||
REG(a0, struct tm *const tmp)
|
||||
)
|
||||
{
|
||||
if (tmp != NULL)
|
||||
tmp->tm_isdst = -1;
|
||||
|
||||
return mktime(tmp);
|
||||
}
|
||||
|
||||
time_t ASM timelocal_z(
|
||||
REG(a1, const timezone_t sp),
|
||||
REG(a0, struct tm *const tmp)
|
||||
)
|
||||
{
|
||||
if (tmp != NULL)
|
||||
tmp->tm_isdst = -1;
|
||||
|
||||
return mktime_z(sp, tmp);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
//--------------------------------------------------------------------------//
|
||||
// This file is in the public domain, so clarified as of //
|
||||
// 2009-05-17 by Arthur David Olson. //
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#include "time_header.h"
|
||||
|
||||
time_t ASM timeoff(
|
||||
REG(a0, struct tm *const tmp),
|
||||
REG(d0, long offset)
|
||||
)
|
||||
{
|
||||
time_t t;
|
||||
|
||||
if ((offset > 0 && offset > INT_FAST32_MAX) ||
|
||||
(offset < 0 && offset < INT_FAST32_MIN)) {
|
||||
errno = EOVERFLOW;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (tmp != NULL)
|
||||
tmp->tm_isdst = 0;
|
||||
|
||||
t = time1(tmp, gmtsub, gmtptr, (int_fast32_t)offset);
|
||||
return t;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
//--------------------------------------------------------------------------//
|
||||
// This file is in the public domain, so clarified as of //
|
||||
// 2009-05-17 by Arthur David Olson. //
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#include "time_header.h"
|
||||
|
||||
const char* ASM tzgetname(
|
||||
REG(a0, const timezone_t sp),
|
||||
REG(d0, int isdst)
|
||||
)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sp->timecnt; ++i) {
|
||||
const struct ttinfo *const ttisp = &sp->ttis[sp->types[i]];
|
||||
|
||||
if (ttisp->tt_isdst == isdst)
|
||||
return &sp->chars[ttisp->tt_abbrind];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
const char* ASM tzgetlocation(void)
|
||||
{
|
||||
static char nowhere[2] = "";
|
||||
|
||||
if (lcl_is_set > 0) {
|
||||
return lcl_TZname;
|
||||
} else {
|
||||
return nowhere;
|
||||
}
|
||||
}
|
||||
|
||||
// Space to underscore
|
||||
void ASM stou(
|
||||
REG(a0, char *s)
|
||||
)
|
||||
{
|
||||
while (*s) {
|
||||
if (*s == ' ') {
|
||||
*s = '_';
|
||||
}
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
// Underscore to space
|
||||
void ASM utos(
|
||||
REG(a0, char *s)
|
||||
)
|
||||
{
|
||||
while (*s) {
|
||||
if (*s == '_') {
|
||||
*s = ' ';
|
||||
}
|
||||
s++;
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
//--------------------------------------------------------------------------//
|
||||
// This file is in the public domain. //
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#include "time_header.h"
|
||||
|
||||
char* ASM tzlocation(void)
|
||||
{
|
||||
static char nowhere[2] = "";
|
||||
|
||||
if (lcl_is_set > 0) {
|
||||
return lcl_TZname;
|
||||
} else {
|
||||
return nowhere;
|
||||
}
|
||||
}
|
||||
|
||||
void ASM underscore_add(
|
||||
REG(a0, char *s)
|
||||
)
|
||||
{
|
||||
while (*s) {
|
||||
if (*s == ' ') {
|
||||
*s = '_';
|
||||
}
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
void ASM underscore_remove(
|
||||
REG(a0, char *s)
|
||||
)
|
||||
{
|
||||
while (*s) {
|
||||
if (*s == '_') {
|
||||
*s = ' ';
|
||||
}
|
||||
s++;
|
||||
}
|
||||
}
|
|
@ -14,3 +14,13 @@ void tzset(void)
|
|||
|
||||
unlock();
|
||||
}
|
||||
|
||||
void tzsetwall(void)
|
||||
{
|
||||
if (lock() != 0)
|
||||
return;
|
||||
|
||||
tzsetlcl(NULL);
|
||||
|
||||
unlock();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "time_header.h"
|
||||
|
||||
void update_tzname_etc(struct state const *sp, struct ttinfo const *ttisp)
|
||||
void update_tzname(struct state const *sp, struct ttinfo const *ttisp)
|
||||
{
|
||||
tzname[ttisp->tt_isdst] = (char *) &sp->chars[ttisp->tt_abbrind];
|
||||
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
#define XSTR(s) STR(s)
|
||||
#define STR(s) #s
|
||||
#define VERSION_NO 2
|
||||
#define VERSION_NO 3
|
||||
#define VERSION XSTR(VERSION_NO)
|
||||
#define REVISION_NO 00
|
||||
#define REVISION XSTR(REVISION_NO)
|
||||
#define DATE "30.07.2015"
|
||||
#define DATE "31.07.2015"
|
||||
#define PACKAGE_TZ "tzcode"
|
||||
#define VERSION_TZ "2015e"
|
||||
#define BUGEMAIL_TZ "carsten.larsen@mail.com"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
all: timezone timezoneinfo setclockgmt zdump dstcheck
|
||||
|
||||
CC = m68k-amigaos-gcc
|
||||
CFLAGS = -O2 -noixemul -DAOS3 -Iinclude -Wall -Werror
|
||||
CFLAGS = -O2 -s -noixemul -DAOS3 -Iinclude -Wall -Werror
|
||||
AR = m68k-amigaos-ar
|
||||
LIBS = -lm
|
||||
|
||||
|
|
|
@ -1,52 +1,30 @@
|
|||
//--------------------------------------------------------------------------//
|
||||
/*
|
||||
* Copyright (c) 2015 Carsten Larsen
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
// This file is in the public domain, so clarified as of //
|
||||
// 2009-05-17 by Arthur David Olson. //
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#ifndef _CLIB_TIMEZONE_H
|
||||
#define _CLIB_TIMEZONE_H
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <devices/timer.h>
|
||||
#include <libraries/locale.h>
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#define TZVARIABLE "timezone.prefs"
|
||||
#define TZDIR "ZONEINFO:"
|
||||
#define TZDEFAULT "localtime"
|
||||
#define TZDEFRULES "posixrules"
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#ifndef HAVE_TIMEZONE_T
|
||||
typedef struct timezone* timezone_t;
|
||||
#endif
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#ifndef HAVE_LOCATE_T
|
||||
typedef struct Locale* locale_t;
|
||||
#endif
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
#ifndef _TIME_H_
|
||||
struct tm {
|
||||
int tm_sec; /* seconds after the minute [0-61] */
|
||||
|
@ -62,7 +40,7 @@ struct tm {
|
|||
char *tm_zone; /* timezone abbreviation */
|
||||
};
|
||||
#endif
|
||||
//--------------------------------------------------------------------------//
|
||||
|
||||
void tzset(void);
|
||||
timezone_t tzalloc(char const *name);
|
||||
void tzfree(timezone_t tz);
|
||||
|
@ -71,15 +49,20 @@ time_t mktime(struct tm *tmp);
|
|||
time_t mktime_z(const timezone_t tz, struct tm *tmp);
|
||||
struct tm* localtime(const time_t *const timep);
|
||||
struct tm* localtime_r(const time_t *const timep, struct tm *tmp);
|
||||
struct tm* localtime_rz(timezone_t tz, time_t const *timep, struct tm *tmp);
|
||||
struct tm* localtime_rz(const timezone_t tz,
|
||||
const time_t *const timep, struct tm *tmp);
|
||||
struct tm* gmtime(const time_t *timep);
|
||||
struct tm* gmtime_r(const time_t *timep, struct tm *tmp);
|
||||
char* ctime(const time_t *const timep);
|
||||
char* ctime_r(const time_t *const timep, char *buf);
|
||||
char *ctime_rz(const timezone_t tz, const time_t *timep, char *buf);
|
||||
double difftime(const time_t time1, const time_t time0);
|
||||
struct tm *offtime(const time_t *timep, long offset);
|
||||
struct tm *offtime_r(const time_t *timep, long offset, struct tm *tmp);
|
||||
time_t timeoff(struct tm *tmp, long offset);
|
||||
char* asctime(const struct tm *timeptr);
|
||||
char* asctime_r(const struct tm *timeptr, char *buf);
|
||||
size_t strftime(char *const s, const size_t maxsize,
|
||||
size_t strftime(char *const s, size_t maxsize,
|
||||
const char *const format, const struct tm *const t);
|
||||
size_t strftime_l(char *const s, size_t maxsize,
|
||||
const char *const format, const struct tm *const t,
|
||||
|
@ -87,22 +70,29 @@ size_t strftime_l(char *const s, size_t maxsize,
|
|||
char* strptime(const char *const buf, const char *const format,
|
||||
struct tm *const t);
|
||||
char* strptime_l(const char *const buf, const char *const format,
|
||||
struct tm *const t, locale_t locale);
|
||||
int daylight_c(void);
|
||||
long timezone_c(void);
|
||||
long altzone_c(void);
|
||||
char** tzname_c(void);
|
||||
//--------------------------------------------------------------------------//
|
||||
struct tm *const t,
|
||||
locale_t locale);
|
||||
time_t timegm(struct tm *tmp);
|
||||
time_t timelocal(struct tm *tmp);
|
||||
time_t timelocal_z(const timezone_t tz, struct tm *tmp);
|
||||
int daylight_c();
|
||||
long timezone_c();
|
||||
long altzone_c();
|
||||
char** tzname_c();
|
||||
const char *tzgetname(const timezone_t tz, int isdst);
|
||||
void tzsetwall(void);
|
||||
time_t time2posix(time_t t);
|
||||
time_t time2posix_z(const timezone_t tz, time_t t);
|
||||
time_t posix2time(time_t t);
|
||||
time_t posix2time_z(const timezone_t tz, time_t t);
|
||||
int getsystime(struct timeval *tv);
|
||||
int setsystime(struct timeval *tv);
|
||||
#if !defined(AVOID_TIMEOFDAY) && !defined(_SYS_TIME_H_)
|
||||
int gettimeofday(struct timeval *tv, const timezone_t tz);
|
||||
int settimeofday(const struct timeval *tv, const timezone_t tz);
|
||||
#endif
|
||||
//--------------------------------------------------------------------------//
|
||||
int gmtoffset(time_t tloc);
|
||||
char* tzlocation();
|
||||
void underscore_add(char *s);
|
||||
void underscore_remove(char *s);
|
||||
//--------------------------------------------------------------------------//
|
||||
const char* tzgetlocation(void);
|
||||
void stou(char *s);
|
||||
void utos(char *s);
|
||||
#endif
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
#endif /* !TIMEZONE_BASE_NAME */
|
||||
|
||||
#define altzone_c() \
|
||||
LP0(0xa2, long, altzone_c, \
|
||||
LP0(0xcc, long, altzone_c, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define asctime(timeptr) \
|
||||
LP1(0x72, char*, asctime, const struct tm *, timeptr, a0, \
|
||||
LP1(0x8a, char*, asctime, const struct tm *, timeptr, a0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define asctime_r(timeptr, buf) \
|
||||
LP2(0x78, char*, asctime_r, const struct tm *, timeptr, a0, char *, buf, a1, \
|
||||
LP2(0x90, char*, asctime_r, const struct tm *, timeptr, a0, char *, buf, a1, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define ctime(timep) \
|
||||
|
@ -31,20 +31,24 @@
|
|||
LP2(0x66, char*, ctime_r, const time_t *const, timep, a0, char *, buf, a1, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define ctime_rz(tz, timep, buf) \
|
||||
LP3(0x6c, char *, ctime_rz, const timezone_t, tz, a2, const time_t *, timep, a0, char *, buf, a1, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define daylight_c() \
|
||||
LP0(0x96, int, daylight_c, \
|
||||
LP0(0xc0, int, daylight_c, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define difftime(time1, time0) \
|
||||
LP2(0x6c, double, difftime, const time_t, time1, d1, const time_t, time0, d0, \
|
||||
LP2(0x72, double, difftime, const time_t, time1, d1, const time_t, time0, d0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define getsystime(tv) \
|
||||
LP1(0xae, int, getsystime, struct timeval *, tv, a0, \
|
||||
LP1(0xf0, int, getsystime, struct timeval *, tv, a0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define gettimeofday(tv, tz) \
|
||||
LP2(0xba, int, gettimeofday, struct timeval *, tv, a0, const timezone_t, tz, a1, \
|
||||
LP2(0xfc, int, gettimeofday, struct timeval *, tv, a0, const timezone_t, tz, a1, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define gmtime(timep) \
|
||||
|
@ -56,7 +60,7 @@
|
|||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define gmtoffset(tloc) \
|
||||
LP1(0xc6, int, gmtoffset, time_t, tloc, d0, \
|
||||
LP1(0x11a, int, gmtoffset, time_t, tloc, d0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define localtime(timep) \
|
||||
|
@ -68,7 +72,7 @@
|
|||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define localtime_rz(tz, timep, tmp) \
|
||||
LP3(0x4e, struct tm*, localtime_rz, timezone_t, tz, a2, time_t const *, timep, a0, struct tm *, tmp, a1, \
|
||||
LP3(0x4e, struct tm*, localtime_rz, const timezone_t, tz, a2, const time_t *const, timep, a0, struct tm *, tmp, a1, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define mktime(tmp) \
|
||||
|
@ -79,36 +83,80 @@
|
|||
LP2(0x3c, time_t, mktime_z, const timezone_t, tz, a1, struct tm *, tmp, a0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define offtime(timep, offset) \
|
||||
LP2(0x78, struct tm *, offtime, const time_t *, timep, a0, long, offset, d0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define offtime_r(timep, offset, tmp) \
|
||||
LP3(0x7e, struct tm *, offtime_r, const time_t *, timep, a0, long, offset, d0, struct tm *, tmp, a1, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define posix2time(t) \
|
||||
LP1(0xe4, time_t, posix2time, time_t, t, d0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define posix2time_z(tz, t) \
|
||||
LP2(0xea, time_t, posix2time_z, const timezone_t, tz, a0, time_t, t, d0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define setsystime(tv) \
|
||||
LP1(0xb4, int, setsystime, struct timeval *, tv, a0, \
|
||||
LP1(0xf6, int, setsystime, struct timeval *, tv, a0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define settimeofday(tv, tz) \
|
||||
LP2(0xc0, int, settimeofday, const struct timeval *, tv, a0, const timezone_t, tz, a1, \
|
||||
LP2(0x102, int, settimeofday, const struct timeval *, tv, a0, const timezone_t, tz, a1, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define stou(s) \
|
||||
LP1NR(0x120, stou, char *, s, a0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define strftime(s, maxsize, format, t) \
|
||||
LP4(0x7e, size_t, strftime, char *const, s, a0, size_t, maxsize, d0, const char *const, format, a1, const struct tm *const, t, a2, \
|
||||
LP4(0x96, size_t, strftime, char *const, s, a0, size_t, maxsize, d0, const char *const, format, a1, const struct tm *const, t, a2, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define strftime_l(s, maxsize, format, t, locale) \
|
||||
LP5(0x84, size_t, strftime_l, char *const, s, a0, size_t, maxsize, d0, const char *const, format, a1, const struct tm *const, t, a2, locale_t, locale, a3, \
|
||||
LP5(0x9c, size_t, strftime_l, char *const, s, a0, size_t, maxsize, d0, const char *const, format, a1, const struct tm *const, t, a2, locale_t, locale, a3, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define strptime(buf, format, t) \
|
||||
LP3(0x8a, char*, strptime, const char *const, buf, a0, const char *const, format, a1, struct tm *const, t, a2, \
|
||||
LP3(0xa2, char*, strptime, const char *const, buf, a0, const char *const, format, a1, struct tm *const, t, a2, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define strptime_l(buf, format, t, locale) \
|
||||
LP4(0x90, char*, strptime_l, const char *const, buf, a0, const char *const, format, a1, struct tm *const, t, a2, locale_t, locale, a3, \
|
||||
LP4(0xa8, char*, strptime_l, const char *const, buf, a0, const char *const, format, a1, struct tm *const, t, a2, locale_t, locale, a3, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define time(p) \
|
||||
LP1(0x30, time_t, time, time_t *, p, a0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define time2posix(t) \
|
||||
LP1(0xd8, time_t, time2posix, time_t, t, d0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define time2posix_z(tz, t) \
|
||||
LP2(0xde, time_t, time2posix_z, const timezone_t, tz, a0, time_t, t, d0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define timegm(tmp) \
|
||||
LP1(0xae, time_t, timegm, struct tm *, tmp, a0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define timelocal(tmp) \
|
||||
LP1(0xb4, time_t, timelocal, struct tm *, tmp, a0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define timelocal_z(tz, tmp) \
|
||||
LP2(0xba, time_t, timelocal_z, const timezone_t, tz, a1, struct tm *, tmp, a0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define timeoff(tmp, offset) \
|
||||
LP2(0x84, time_t, timeoff, struct tm *, tmp, a0, long, offset, d0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define timezone_c() \
|
||||
LP0(0x9c, long, timezone_c, \
|
||||
LP0(0xc6, long, timezone_c, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define tzalloc(name) \
|
||||
|
@ -119,24 +167,28 @@
|
|||
LP1NR(0x2a, tzfree, timezone_t, tz, a0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define tzlocation() \
|
||||
LP0(0xcc, char*, tzlocation, \
|
||||
#define tzgetlocation() \
|
||||
LP0(0x114, const char*, tzgetlocation, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define tzgetname(tz, isdst) \
|
||||
LP2(0x10e, const char *, tzgetname, const timezone_t, tz, a0, int, isdst, d0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define tzname_c() \
|
||||
LP0(0xa8, char**, tzname_c, \
|
||||
LP0(0xd2, char**, tzname_c, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define tzset() \
|
||||
LP0NR(0x1e, tzset, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define underscore_add(s) \
|
||||
LP1NR(0xd2, underscore_add, char *, s, a0, \
|
||||
#define tzsetwall() \
|
||||
LP0NR(0x108, tzsetwall, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#define underscore_remove(s) \
|
||||
LP1NR(0xd8, underscore_remove, char *, s, a0, \
|
||||
#define utos(s) \
|
||||
LP1NR(0x126, utos, char *, s, a0, \
|
||||
, TIMEZONE_BASE_NAME)
|
||||
|
||||
#endif /* !_INLINE_TIMEZONE_H */
|
||||
|
|
|
@ -261,7 +261,7 @@ void load_tz()
|
|||
FreeVec(tz);
|
||||
tz = NULL;
|
||||
} else {
|
||||
underscore_remove(tz);
|
||||
utos(tz);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ void use_tz()
|
|||
long checked;
|
||||
|
||||
if (tz != NULL) {
|
||||
underscore_add(tz);
|
||||
stou(tz);
|
||||
SetVar((STRPTR)TZVARIABLE, (STRPTR)tz, strlen(tz) + 1, GVF_GLOBAL_ONLY);
|
||||
|
||||
GT_GetGadgetAttrs(usetzgad, window, NULL, GTCB_Checked, &checked, TAG_END);
|
||||
|
@ -300,7 +300,7 @@ void save_tz()
|
|||
BPTR file;
|
||||
|
||||
if (tz != NULL) {
|
||||
underscore_add(tz);
|
||||
stou(tz);
|
||||
|
||||
name = (char*)AllocVec(7 + strlen(TZVARIABLE) + 1, MEMF_ANY | MEMF_CLEAR);
|
||||
strcpy(name, "ENVARC:");
|
||||
|
@ -388,7 +388,7 @@ void populate_list()
|
|||
if ((node = AllocVec(sizeof(struct Node) + strlen(locations[i].tz) + 1, MEMF_CLEAR))) {
|
||||
node->ln_Name = (char*)(node + 1);
|
||||
strcpy(node->ln_Name,locations[i].tz);
|
||||
underscore_remove(node->ln_Name);
|
||||
utos(node->ln_Name);
|
||||
AddTail(&lvlist, node);
|
||||
|
||||
if (!strcmp(tz, node->ln_Name)) {
|
||||
|
|
|
@ -22,7 +22,7 @@ int main(const int argc, char *argv[])
|
|||
} offset;
|
||||
|
||||
time_t now ;
|
||||
char* loc;
|
||||
const char* loc;
|
||||
|
||||
TimezoneBase = (struct Library*)OpenLibrary((STRPTR)"timezone.library", 0);
|
||||
if (!TimezoneBase) {
|
||||
|
@ -35,7 +35,7 @@ int main(const int argc, char *argv[])
|
|||
|
||||
offset.hours = tm.tm_gmtoff / 60 / 60;
|
||||
offset.mins = tm.tm_gmtoff / 60 - offset.hours * 60;
|
||||
loc = tzlocation();
|
||||
loc = tzgetlocation();
|
||||
|
||||
FPrintf(Output(), (STRPTR)"Location is %s\n", loc);
|
||||
FPrintf(Output(), (STRPTR)"Time zone is %s\n", tm.tm_zone);
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
#define DOSLIB_NAME "dos.library"
|
||||
#define DOSLIB_REV 37L
|
||||
#define TIMEZONELIB_NAME "timezone.library"
|
||||
#define TIMEZONELIB_REV 2L
|
||||
#define TIMEZONELIB_REV 3L
|
||||
#define TIMER_NAME TIMERNAME
|
||||
#define BATTCLOCK_NAME BATTCLOCKNAME
|
||||
#define PUBSCREEN_NAME "PubScreen"
|
||||
|
@ -105,11 +105,11 @@
|
|||
|
||||
#define XSTR(s) STR(s)
|
||||
#define STR(s) #s
|
||||
#define VERSION_NO 2
|
||||
#define VERSION_NO 3
|
||||
#define VERSION XSTR(VERSION_NO)
|
||||
#define REVISION_NO 00
|
||||
#define REVISION XSTR(REVISION_NO)
|
||||
#define DATE "30.07.2015"
|
||||
#define DATE "31.07.2015"
|
||||
#define PACKAGE_TZ "tzcode"
|
||||
#define VERSION_TZ "2015e"
|
||||
#define BUGEMAIL_TZ "carsten.larsen@mail.com"
|
||||
|
|
Loading…
Reference in New Issue