Revision 1,06 changes

This commit is contained in:
llsth 2015-07-30 18:22:54 +02:00
parent e4be9f5b09
commit c49ebd5874
4 changed files with 136 additions and 62 deletions

View File

@ -1,6 +1,7 @@
History
-------
1.06 Rebuild with version 3 of Time Zone Database.
1.05 Fixed GMT bug appearing when not using Time Zone Database.
1.04 Bug-fixes in TCP/IP and debugging logic.
1.03 Rebuild for AROS. Removed broken Time Zone Database library.

View File

@ -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,31 +49,50 @@ 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,
size_t strftime_l(char *const s, size_t maxsize,
const char *const format, const struct tm *const t,
locale_t locale);
//--------------------------------------------------------------------------//
void getsystime(struct timeval *tv);
void setsystime(struct timeval *tv);
#ifndef AVOID_TIMEOFDAY
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);
#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);
void underscore_add(char *s);
void underscore_remove(char *s);
//--------------------------------------------------------------------------//
const char* tzgetlocation(void);
void stou(char *s);
void utos(char *s);
#endif

View File

@ -11,12 +11,16 @@
#define TIMEZONE_BASE_NAME TimezoneBase
#endif /* !TIMEZONE_BASE_NAME */
#define 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) \
@ -27,17 +31,25 @@
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(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) \
LP1NR(0x8a, getsystime, struct timeval *, tv, a0, \
LP1(0xf0, int, getsystime, struct timeval *, tv, a0, \
, TIMEZONE_BASE_NAME)
#ifndef AVOID_TIMEOFDAY
#define gettimeofday(tv, tz) \
LP2(0x96, 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)
#endif
@ -50,7 +62,7 @@
, TIMEZONE_BASE_NAME)
#define gmtoffset(tloc) \
LP1(0xa2, int, gmtoffset, time_t, tloc, d0, \
LP1(0x11a, int, gmtoffset, time_t, tloc, d0, \
, TIMEZONE_BASE_NAME)
#define localtime(timep) \
@ -62,7 +74,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) \
@ -73,28 +85,84 @@
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) \
LP1NR(0x90, setsystime, struct timeval *, tv, a0, \
LP1(0xf6, int, setsystime, struct timeval *, tv, a0, \
, TIMEZONE_BASE_NAME)
#ifndef AVOID_TIMEOFDAY
#define settimeofday(tv, tz) \
LP2(0x9c, 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)
#endif
#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(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(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(0xc6, long, timezone_c, \
, TIMEZONE_BASE_NAME)
#define tzalloc(name) \
LP1(0x24, timezone_t, tzalloc, char const *, name, a0, \
, TIMEZONE_BASE_NAME)
@ -103,20 +171,28 @@
LP1NR(0x2a, tzfree, timezone_t, tz, a0, \
, TIMEZONE_BASE_NAME)
#define tzlocation() \
LP0(0xa8, 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(0xd2, char**, tzname_c, \
, TIMEZONE_BASE_NAME)
#define tzset() \
LP0NR(0x1e, tzset, \
, TIMEZONE_BASE_NAME)
#define underscore_add(s) \
LP1NR(0xae, underscore_add, char *, s, a0, \
#define tzsetwall() \
LP0NR(0x108, tzsetwall, \
, TIMEZONE_BASE_NAME)
#define underscore_remove(s) \
LP1NR(0xb4, underscore_remove, char *, s, a0, \
#define utos(s) \
LP1NR(0x126, utos, char *, s, a0, \
, TIMEZONE_BASE_NAME)
#endif /* !_INLINE_TIMEZONE_H */

View File

@ -69,7 +69,7 @@
#define BSDLIB_NAME "bsdsocket.library"
#define BSDLIB_REV 03L
#define TIMEZONELIB_NAME "timezone.library"
#define TIMEZONELIB_REV 2L
#define TIMEZONELIB_REV 3L
#define TIMER_NAME TIMERNAME
#define BATTCLOCK_NAME BATTCLOCKNAME
#define HAVE_WAITSELECT 1