Release 5 changes

This commit is contained in:
Carsten Larsen
2016-10-25 21:12:38 +00:00
parent 4bc6d81ba6
commit 58341f9220
58 changed files with 728 additions and 1318 deletions
+26
View File
@@ -0,0 +1,26 @@
Amiga Time zone library release log
5.00 Sun, 16 Oct 2016
- TimeZone selector now adjust time when timezone i changed.
- Fixed gmt calculation bug in time(), gettimeofday() and settimeofday().
- Semaphores now work in static library.
- Cleaned up headers in source files. Copyrighted code are now clearly
marked as such.
- Updated documentation and added more examples.
- Included POSIX date command from tz release 2016g.
4.00 Wed, 05 Oct 2016
- Synced code to tz release 2016g.
- Added gmt offset adjust in time(), gettimeofday() and settimeofday().
- Build of static link library libtz.a.
- Fixed buffer overflow bug in loadtz().
- Cleaned up headers in source files.
3.00 Thu, 30 Jul 2015
- Miscellaneous bug fixes.
2.00
- Initial release.
1.00
- Alpha release.
+7 -2
View File
@@ -1,9 +1,14 @@
all: date1 date2 gmtime localtime nyc strftime strftime2 strptime time
all: date1 date2 gmtime localtime nyc strftime strftime2 strptime time adjust
CC = m68k-amigaos-gcc
CFLAGS = -O2 -s -noixemul -I../utility/include -Wall -Werror
LIBS =
adjust.o: adjust.c
adjust: adjust.o
${CC} ${CFLAGS} -o adjust adjust.o
date1.o: date1.c
date1: date1.o
@@ -50,7 +55,7 @@ time: time.o
${CC} ${CFLAGS} -o time time.o
clean:
rm -f *.o date1 date2 gmtime localtime nyc strftime strftime2 strptime time
rm -f *.o date1 date2 gmtime localtime nyc strftime strftime2 strptime time adjust
depend:
@echo Dependencies already done
+61
View File
@@ -0,0 +1,61 @@
#include <stdio.h>
#include <proto/exec.h>
#include <clib/dos_protos.h>
#include "clib/timezone.h"
#include "inline/timezone.h"
struct Library *TimezoneBase;
void show()
{
time_t rawtime;
struct tm *info;
struct tm tmp;
char buffer[80];
int daylight;
long timezone;
long altzone;
char** tzname;
time(&rawtime);
info = localtime_r(&rawtime,&tmp);
strftime(buffer,80,"%+", info);
printf("%s\n", buffer);
daylight = daylight_c();
timezone = timezone_c();
altzone = altzone_c();
tzname = tzname_c();
printf("daylight (est): %d\n", daylight);
printf("timezone: %ld\n", timezone);
printf("altzone: %ld\n", altzone);
printf("tzname[0]: %s\n", tzname[0]);
printf("tzname[1]: %s\n", tzname[1]);
}
void set(char *tz)
{
printf("--------------------------------------------\n");
show();
SetVar((STRPTR)TZVARIABLE, (STRPTR)tz, strlen(tz) + 1, GVF_GLOBAL_ONLY);
tzset();
printf("----------------- tzset --------------------\n");
show();
printf("--------------------------------------------\n");
}
int main()
{
TimezoneBase = OpenLibrary("timezone.library", 3L);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 5;
}
set("Europe/Copenhagen");
set("Europe/Moscow");
set("Europe/Copenhagen");
CloseLibrary(TimezoneBase);
return 0;
}
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h> // printf
#include <string.h> // memset
//#include <time.h> // POSIX include file
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
+1 -4
View File
@@ -74,14 +74,11 @@ typedef struct Locale *locale_t;
#define TZDEFAULT "localtime"
#define TZDEFRULES "posixrules"
//void _fmtcallback(unsigned char, unsigned char**);
const unsigned long _fmtcallback[20];
extern struct ExecBase* SysBase;
extern struct Library* DOSBase;
extern struct Library* UtilityBase;
extern struct Library* MathIeeeDoubBasBase;
extern struct Library* LocaleBase;
extern struct SignalSemaphore TimeSemaphore;
extern struct SignalSemaphore* TimeSemaphore;
#endif
+1 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2015-2016 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
* All rights reserved.
*
+1
View File
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2015-2016 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
* All rights reserved.
*
+1
View File
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2015-2016 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
* All rights reserved.
*
+47 -26
View File
@@ -2,28 +2,63 @@
#include "compiler.h"
#include "time_header.h"
int isdigit(int c)
int isdigit(char c)
{
return ('0' <= c && c <= '9');
switch (c) {
default:
return 0;
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9': case '0':
return 1;
}
}
int isspace(int c)
int isspace(char c)
{
return (
c == '\t' ||
c == '\r' ||
c == '\n' ||
c == '\v' ||
c == '\f' ||
c == ' '
);
switch (c) {
default:
return 0;
case '\t': case '\r': case '\n': case '\v': case '\f': case ' ':
return 1;
}
}
int toupper(int c)
int isalpha(char c)
{
switch (c) {
default:
return 0;
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G':
case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N':
case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U':
case 'V': case 'W': case 'X': case 'Y': case 'Z':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g':
case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u':
case 'v': case 'w': case 'x': case 'y': case 'z':
return 1;
}
}
int toupper(char c)
{
return ('a' <= c && c <= 'z') ? (c - ('a' - 'A')) : c;
}
size_t strlen(const char *string)
{
const char *s = string;
const char *start = s;
size_t result = 0;
while((*s) != '\0')
s++;
result = (size_t)(s - start);
return result;
}
void *memmove(void *, const void *, size_t);
void bcopy(const void *src,void *dest,size_t len)
@@ -106,20 +141,6 @@ char *strcpy(char *dest, const char *src)
return(result);
}
size_t strlen(const char *string)
{
const char *s = string;
const char *start = s;
size_t result = 0;
while((*s) != '\0')
s++;
result = (size_t)(s - start);
return result;
}
int strncmp(const char *s1, const char *s2, size_t n)
{
int result = 0;
+13 -3
View File
@@ -84,7 +84,8 @@ bool UserLibInit(
MathIeeeDoubBasBase = NULL;
UtilityBase = NULL;
LocaleBase = NULL;
TimeSemaphore = NULL;
DOSBase = OpenLibrary(DOSLIB_NAME, LIB_VERSION);
if (!DOSBase) {
result = false;
@@ -105,12 +106,17 @@ bool UserLibInit(
result = false;
}
InitSemaphore(&TimeSemaphore);
TimeSemaphore = (struct SignalSemaphore*)AllocMem(
sizeof(struct SignalSemaphore),
MEMF_ANY|MEMF_PUBLIC|MEMF_CLEAR);
InitSemaphore(TimeSemaphore);
lcl_is_set = -1;
lcl_is_set = 0;
timezone = 0;
altzone = 0;
daylight = 0;
zonechg = 0;
errno = 0;
return result;
@@ -201,6 +207,10 @@ void UserLibExpunge(struct UserData * ud)
FreeMem(gmtptr, sizeof(struct state));
}
if(TimeSemaphore) {
FreeMem(TimeSemaphore, sizeof(struct SignalSemaphore));
}
if (LocaleBase) {
CloseLibrary(LocaleBase);
}
+2
View File
@@ -5,6 +5,7 @@
#define MAX_ASCTIME_BUF_SIZE 64
static char buf_asctime[MAX_ASCTIME_BUF_SIZE];
static const unsigned long _fmtcallback[] = { 0x16c04e75 };
struct out {
const char* wn;
@@ -66,3 +67,4 @@ char* asctime(const struct tm *timeptr)
{
return asctime_r(timeptr, buf_asctime);
}
+4 -3
View File
@@ -128,9 +128,10 @@ char *strchr(const char *s, int c); // <string.h>
int strncmp(const char *s1, const char *s2, size_t n); // <string.h>
char *getenv(const char * name); // <stdlib.h>
int isdigit(int c);
int isspace(int c);
int toupper(int c);
int isdigit(char c);
int isspace(char c);
int isalpha(char c);
int toupper(char c);
int strncasecmp(const char * _s1, const char * _s2, size_t n);
#if defined(__GNUC__) && (__GNUC__ < 3)
+9 -9
View File
@@ -7,10 +7,10 @@ struct tm * localsub(
struct tm* const tmp
)
{
const struct ttinfo* ttisp;
int i;
struct tm* result;
const time_t t = *timep;
register const struct ttinfo* ttisp;
register int i;
register struct tm* result;
const time_t t = *timep;
if (sp == NULL) {
// Don't bother to set tzname etc.; tzset has already done it.
@@ -20,8 +20,8 @@ struct tm * localsub(
if ((sp->goback && t < sp->ats[0]) || (sp->goahead && t > sp->ats[sp->timecnt - 1])) {
time_t newt = t;
time_t seconds;
time_t years;
register time_t seconds;
register time_t years;
if (t < sp->ats[0]) {
seconds = sp->ats[0] - t;
@@ -68,11 +68,11 @@ struct tm * localsub(
i = sp->defaulttype;
} else {
int lo = 1;
int hi = sp->timecnt;
register int lo = 1;
register int hi = sp->timecnt;
while (lo < hi) {
int mid = (lo + hi) >> 1;
register int mid = (lo + hi) >> 1;
if (t < sp->ats[mid]) {
hi = mid;
+6 -3
View File
@@ -1,14 +1,17 @@
#include "time_header.h"
struct SignalSemaphore TimeSemaphore;
struct SignalSemaphore* TimeSemaphore = NULL;
int lock(void)
{
ObtainSemaphore(&TimeSemaphore);
if (TimeSemaphore != NULL)
ObtainSemaphore(TimeSemaphore);
return 0;
}
void unlock(void)
{
ReleaseSemaphore(&TimeSemaphore);
if (TimeSemaphore != NULL)
ReleaseSemaphore(TimeSemaphore);
}
+2 -1
View File
@@ -10,7 +10,8 @@ void settzname(void)
daylight = 0;
timezone = 0;
altzone = 0;
zonechg = 1;
if (sp == NULL) {
tzname[0] = tzname[1] = (char *) gmt;
return;
+1
View File
@@ -17,6 +17,7 @@ struct state *gmtptr;
long timezone;
long altzone;
int daylight;
int zonechg;
int errno;
+2
View File
@@ -86,4 +86,6 @@ extern long altzone;
extern int errno;
int zonechg;
#endif
+2 -8
View File
@@ -38,6 +38,8 @@ extern char* tzname[];
#define IN_THIS 2
#define IN_ALL 3
static const unsigned long _fmtcallback[] = { 0x16c04e75 };
size_t strftime(
char * const s,
size_t maxsize,
@@ -556,11 +558,3 @@ static char* _yconv(
pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim);
return pt;
}
const unsigned long _fmtcallback[] = { 0x16c04e75 };
/*
void _fmtcallback(unsigned char c, unsigned char **data)
{
*(*data)++=c;
}
*/
+35 -12
View File
@@ -6,7 +6,28 @@
// 2922 is the number of days between 1.1.1970 and 1.1.1978
// (2 leap years and 6 normal)
// 2922 * 24 * 60 * 60 = 252460800
#define AMIGAOFFSET 252460800
#define AMIGAOFFSET 252460800L
struct state *adj_lclptr;
struct tm adj_tm;
long gmtoffset_c(struct timeval *tv)
{
time_t time = (time_t)tv->tv_secs;
if (!lcl_is_set)
return 0;
if (zonechg || lclptr != adj_lclptr) {
localtime_rz(lclptr, &time, &adj_tm);
adj_lclptr = lclptr;
zonechg = 0;
}
// TODO: include logic to detect dst change
return -adj_tm.tm_gmtoff;
}
/**
* @brief
@@ -22,19 +43,14 @@ time_t time(time_t *tloc)
long zone;
time_t time;
struct timeval tv;
if (CreateTimer() != 0) {
return 0;
}
GetSysTime(&tv);
if(lcl_is_set) {
zone = (daylight == 0 ? timezone : altzone);
} else {
zone = 0;
}
zone = gmtoffset_c(&tv);
time = (time_t)(tv.tv_secs + AMIGAOFFSET + zone);
if (tloc) {
@@ -47,16 +63,19 @@ time_t time(time_t *tloc)
int gettimeofday(struct timeval *tv, const timezone_t tz)
{
long zone;
time_t time;
struct tm tm;
if (CreateTimer() != 0) {
return -1;
}
zone = gmtoffset_c(tv);
TimeRequest->tr_node.io_Command = TR_GETSYSTIME;
DoIO((struct IORequest*)TimeRequest);
tv->tv_secs = (long)TimeRequest->tr_time.tv_secs + AMIGAOFFSET;
tv->tv_secs = (long)TimeRequest->tr_time.tv_secs + AMIGAOFFSET + zone;
tv->tv_micro = TimeRequest->tr_time.tv_micro;
time = tv->tv_secs;
@@ -72,14 +91,18 @@ int gettimeofday(struct timeval *tv, const timezone_t tz)
int settimeofday(const struct timeval *tv, const timezone_t tz)
{
long zone;
if (CreateTimer() != 0) {
return -1;
}
zone = gmtoffset_c((struct timeval*)tv);
// TODO: Include timezone in logic
TimeRequest->tr_node.io_Command = TR_SETSYSTIME;
TimeRequest->tr_time.tv_secs = (long)tv->tv_secs - AMIGAOFFSET;
TimeRequest->tr_time.tv_secs = (long)tv->tv_secs - AMIGAOFFSET - zone;
TimeRequest->tr_time.tv_micro = tv->tv_micro;
DoIO((struct IORequest*)TimeRequest);
+2 -2
View File
@@ -3,11 +3,11 @@
#define XSTR(s) STR(s)
#define STR(s) #s
#define VERSION_NO 4
#define VERSION_NO 5
#define VERSION XSTR(VERSION_NO)
#define REVISION_NO 00
#define REVISION XSTR(REVISION_NO)
#define DATE "05.10.2016"
#define DATE "15.10.2016"
#define PACKAGE_TZ "tzcode"
#define VERSION_TZ "2016g"
#define BUGEMAIL_TZ "cs@innolan.dk"
+7
View File
@@ -0,0 +1,7 @@
DSTCheck
If Warn
Echo "We have DST !"
Else
Echo "We don't have DST !"
Endif
+1
View File
@@ -0,0 +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 Australia/Melbourne Pacific/Noumea Pacific/Galapagos Europe/Amsterdam Europe/Athens Europe/Lisbon Europe/London Europe/Moscow
+1
View File
@@ -0,0 +1 @@
ZDump America/Adak America/Anchorage America/Anguilla America/Antigua America/Araguaina America/Argentina/Buenos_Aires America/Argentina/Catamarca America/Argentina/Cordoba America/Argentina/Jujuy America/Argentina/La_Rioja America/Argentina/Mendoza America/Argentina/Rio_Gallegos America/Argentina/Salta America/Argentina/San_Juan America/Argentina/San_Luis America/Argentina/Tucuman America/Argentina/Ushuaia America/Aruba America/Asuncion America/Atikokan America/Bahia America/Bahia_Banderas America/Barbados America/Belem America/Belize America/Blanc-Sablon America/Boa_Vista America/Bogota America/Boise America/Cambridge_Bay America/Campo_Grande America/Cancun America/Caracas America/Cayenne America/Cayman America/Chicago America/Chihuahua America/Costa_Rica America/Creston America/Cuiaba America/Curacao America/Danmarkshavn America/Dawson America/Dawson_Creek America/Denver America/Detroit America/Dominica America/Edmonton America/Eirunepe America/El_Salvador America/Fortaleza America/Glace_Bay America/Godthab America/Goose_Bay America/Grand_Turk America/Grenada America/Guadeloupe America/Guatemala America/Guayaquil America/Guyana America/Halifax America/Havana America/Hermosillo America/Indiana/Indianapolis America/Indiana/Knox America/Indiana/Marengo America/Indiana/Petersburg America/Indiana/Tell_City America/Indiana/Vevay America/Indiana/Vincennes America/Indiana/Winamac
+1
View File
@@ -0,0 +1 @@
ZDump America/Inuvik America/Iqaluit America/Jamaica America/Juneau America/Kentucky/Louisville America/Kentucky/Monticello America/Kralendijk America/La_Paz America/Lima America/Los_Angeles America/Lower_Princes America/Maceio America/Managua America/Manaus America/Marigot America/Martinique America/Matamoros America/Mazatlan America/Menominee America/Merida America/Metlakatla America/Mexico_City America/Miquelon America/Moncton America/Monterrey America/Montevideo America/Montserrat America/Nassau America/New_York America/Nipigon America/Nome America/Noronha America/North_Dakota/Beulah America/North_Dakota/Center America/North_Dakota/New_Salem America/Ojinaga America/Panama America/Pangnirtung America/Paramaribo America/Phoenix America/Port-au-Prince America/Port_of_Spain America/Porto_Velho America/Puerto_Rico America/Rainy_River America/Rankin_Inlet America/Recife America/Regina America/Resolute America/Rio_Branco America/Santa_Isabel America/Santarem America/Santiago America/Santo_Domingo America/Sao_Paulo America/Scoresbysund America/Sitka America/St_Barthelemy America/St_Johns America/St_Kitts America/St_Lucia America/St_Thomas America/St_Vincent America/Swift_Current America/Tegucigalpa America/Thule America/Thunder_Bay America/Tijuana America/Toronto America/Tortola America/Vancouver America/Whitehorse America/Winnipeg America/Yakutat America/Yellowknife
+1
View File
@@ -0,0 +1 @@
ZDump Asia/Aden Asia/Almaty Asia/Amman Asia/Anadyr Asia/Aqtau Asia/Aqtobe Asia/Ashgabat Asia/Baghdad Asia/Bahrain Asia/Baku Asia/Bangkok Asia/Beirut Asia/Bishkek Asia/Brunei Asia/Chita Asia/Choibalsan Asia/Colombo Asia/Damascus Asia/Dhaka Asia/Dili Asia/Dubai Asia/Dushanbe Asia/Gaza Asia/Hebron Asia/Ho_Chi_Minh Asia/Hong_Kong Asia/Hovd Asia/Irkutsk Asia/Istanbul Asia/Jakarta Asia/Jayapura Asia/Jerusalem Asia/Kabul Asia/Kamchatka Asia/Karachi Asia/Kathmandu Asia/Khandyga Asia/Kolkata Asia/Krasnoyarsk Asia/Kuala_Lumpur Asia/Kuching Asia/Kuwait Asia/Macau Asia/Magadan Asia/Makassar Asia/Manila Asia/Muscat Asia/Nicosia Asia/Novokuznetsk Asia/Novosibirsk Asia/Omsk Asia/Oral Asia/Phnom_Penh Asia/Pontianak Asia/Pyongyang Asia/Qatar Asia/Qyzylorda Asia/Rangoon Asia/Riyadh Asia/Sakhalin Asia/Samarkand Asia/Seoul Asia/Shanghai Asia/Singapore Asia/Srednekolymsk Asia/Taipei Asia/Tashkent Asia/Tbilisi Asia/Tehran Asia/Thimphu Asia/Tokyo Asia/Ulaanbaatar Asia/Urumqi Asia/Ust-Nera Asia/Vientiane Asia/Vladivostok Asia/Yakutsk Asia/Yekaterinburg Asia/Yerevan
+1
View File
@@ -0,0 +1 @@
ZDump Europe/Amsterdam Europe/Andorra Europe/Athens Europe/Belgrade Europe/Berlin Europe/Bratislava Europe/Brussels Europe/Bucharest Europe/Budapest Europe/Busingen Europe/Chisinau Europe/Copenhagen Europe/Dublin Europe/Gibraltar Europe/Guernsey Europe/Helsinki Europe/Isle_of_Man Europe/Istanbul Europe/Jersey Europe/Kaliningrad Europe/Kiev Europe/Lisbon Europe/Ljubljana Europe/London Europe/Luxembourg Europe/Madrid Europe/Malta Europe/Mariehamn Europe/Minsk Europe/Monaco Europe/Moscow Europe/Nicosia Europe/Oslo Europe/Paris Europe/Podgorica Europe/Prague Europe/Riga Europe/Rome Europe/Samara Europe/San_Marino Europe/Sarajevo Europe/Simferopol Europe/Skopje Europe/Sofia Europe/Stockholm Europe/Tallinn Europe/Tirane Europe/Uzhgorod Europe/Vaduz Europe/Vatican Europe/Vienna Europe/Vilnius Europe/Volgograd Europe/Warsaw Europe/Zagreb Europe/Zaporozhye Europe/Zurich
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include "time_tm.h"
#include "time_header.h"
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <exec/libraries.h>
#include "clib_timezone.h"
+1 -6
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "time_header.h"
#include <stdio.h>
@@ -21,7 +17,7 @@ int main(const int argc, char *argv[])
UtilityBase = NULL;
LocaleBase = NULL;
TimerBase = NULL;
TimeRequest = NULL;
TimeRequest = NULL;
DOSBase = OpenLibrary(DOSLIB_NAME, LIB_VERSION);
if (!DOSBase) {
@@ -74,4 +70,3 @@ int main(const int argc, char *argv[])
return 0;
}
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include "proto/exec.h"
#include "compiler.h"
#include "time_tm.h"
+1 -7
View File
@@ -1,13 +1,7 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
// Compile with:
// m68k-amigaos-gcc -I../library -c test_tzload.c
// Link with:
// m68k-amigaos-gcc -noixemul test_tzload.o -o tzload ../library/time_tzload.o
// ../library/time_tzparse.o ../library/time_state.o ../library/time_init_ttinfo.o
// ../library/time_length.o ../library/time_increment_ot.o
// m68k-amigaos-gcc -noixemul test_tzload.o -o tzload libtz.a
#include "proto/exec.h"
#include "time_tm.h"
+6 -13
View File
@@ -1,7 +1,7 @@
@database tzc.guide
@author Carsten Larsen
@(c) Carsten Larsen
@$VER: tz.guide 4.00 (05.10.2016)
@$VER: tz.guide 5.00 (15.10.2016)
@node Main "Amiga time zone database"
@title "Amiga time zone database"
@@ -50,14 +50,13 @@ Optionally
* Copy SetClockGMT to your systems C:
* Copy TimeZone to your systems SYS:Prefs
* Copy files in Help to LOCALE:Help/TimeZone
* Assign ZONEINFO: to LOCALE:Zoneinfo in S:Startup-Sequence
* Add SetClockGMT <NIL: >NIL: LOAD to end of S:Startup-Sequence
@{b}SETUP@{ub}
Select a Time Zone:
Open TimeZone GUI
Select a time zone in TimeZone GUI:
TimeZone
Save GMT time to RTC (hardware) clock:
SetClockGMT SAVE
@@ -69,7 +68,7 @@ Validate time zone preferences in shell:
TimeZoneInfo
Show time in other time zones:
Execute example/misc
Execute script/Show
@@ -188,8 +187,8 @@ proposing and distributing patches is via email as illustrated above.
The time zone name will be save to the TZ environment variable if selected.
Do not choose this option if you already have a rule in your TZ variable.
@{bg filltext}@{b} July 25, 2015 TimeZone@{ub}@{bg background}
@endnode
@node TimeZoneInfo "TimeZoneInfo user manual"
@title "TimeZoneInfo user manual"
@@ -206,7 +205,6 @@ proposing and distributing patches is via email as illustrated above.
zone.
@{bg filltext}@{b} July 25, 2015 TimeZoneInfo@{ub}@{bg background}
@endnode
@node SetClockGMT "SetClockGMT user manual"
@title "SetClockGMT user manual"
@@ -236,7 +234,6 @@ proposing and distributing patches is via email as illustrated above.
off or sets the test bit of the clock.
@{bg filltext}@{b} July 25, 2015 SetClockGMT@{ub}@{bg background}
@endnode
@node DSTCheck "DSTCheck user manual"
@title "DSTCheck user manual"
@@ -261,14 +258,13 @@ proposing and distributing patches is via email as illustrated above.
ENDIF
@{bg filltext}@{b} July 25, 2015 DSTCheck@{ub}@{bg background}
@endnode
@node library "Timezone Library"
@title "Timezone Library"
@{b}timezone.library@{ub}
Version 3 of the Timezone Library implements the following functions.
Version 5 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, ctime_rz, difftime,
@@ -346,7 +342,6 @@ extra getsystime, setsystime, tzgetlocation, gmtoffset, stou, utos
@{"tzfile" link "tzfile"}, @{"zic" link "zic"}
@{bg filltext}@{b} July 25, 2015 ZDump@{ub}@{bg background}
@endnode
@node zic "zic developer manual"
@title "Time zone compiler"
@@ -699,7 +694,6 @@ extra getsystime, setsystime, tzgetlocation, gmtoffset, stou, utos
@{"tzfile" link "tzfile"}, @{"zdump" link "zdump"}
@{bg filltext}@{b} July 25, 2015 ZIC@{ub}@{bg background}
@endnode
@node tzfile "tzfile developer manual"
@title "Time zone information"
@@ -811,5 +805,4 @@ extra getsystime, setsystime, tzgetlocation, gmtoffset, stou, utos
@{"zdump" link "zdump"}, @{"zic" link "zic"}
@{bg filltext}@{b} July 25, 2015 TZFILE@{ub}@{bg background}
@endnode
+3 -8
View File
@@ -2,14 +2,11 @@ Short: Time Zone Database and Library (source)
Author: Carsten Larsen, Arthur David Olson & others
Uploader: Carsten Larsen (carsten larsen mail com)
Type: util/time
Version: 4.00
Version: 5.00
Requires: util/time/tzdata
Architecture: generic
URL: http://www.iana.org/time-zones
"What time is it?" -- Richard Deacon as The King
"Any time you want it to be." -- Frank Baxter as The Scientist
(from the Bell System film "About Time")
The Time Zone Database (often called tz or zoneinfo) contains code and
data that represent the history of local time for many representative
@@ -50,11 +47,11 @@ extra
Utilities
DSTCheck, SetClockGMT, TimeZone, TimeZoneInfo, ZDump
Date, DSTCheck, SetClockGMT, TimeZone, TimeZoneInfo, ZDump
Example programs
date1, date2, gmtime, localtime, nyc, strftime, strftime2, strptime,
time
time, adjust
License and Credits
@@ -75,6 +72,4 @@ None of them are responsible for remaining errors.
Look in ftp://ftp.iana.org/tz/releases/ for updated versions of these files.
Amiga variants are at: ftp://aminet.net/util/time/tzdev.zip
Please send general comments or information to tz@iana.org.
+23 -11
View File
@@ -1,4 +1,4 @@
all: timezone timezoneinfo setclockgmt zdump dstcheck
all: timezone timezoneinfo setclockgmt zdump dstcheck date
CC = m68k-amigaos-gcc
CFLAGS = -O2 -s -noixemul -DAOS3 -Iinclude -Wall
@@ -11,15 +11,18 @@ tzversion.h:
private.h:
touch private.h
getopt.h:
touch getopt.h
zdump_amiga.o: zdump_amiga.c private.h tzversion.h
zic.o: zic.c private.h tzversion.h tzfile.h
zic_amiga.o: zic_amiga.c private.h tzversion.h
zic_amiga.o: zic_amiga.c private.h tzversion.h
strtoll.o: strtoll.c tzversion.h
date_amiga.o: date_amiga.c private.h tzversion.h
getopt.o: getopt.c getopt.h
date.o: date.c private.h tzversion.h
@@ -31,11 +34,20 @@ setclockgmt.o: setclockgmt.c tzversion.h
dstcheck.o: dstcheck.c tzversion.h
zic: zic.o zic_amiga.o
${CC} ${CFLAGS} -o zic zic.o zic_amiga.o -liberty
dstcheck_amiga.o: private.h tzversion.h
${CC} ${CFLAGS} -DPROG_NAME=\"DSTCheck\" -c tzversion.c -o dstcheck_amiga.o
date: date.o date_amiga.o strtoll.o
${CC} ${CFLAGS} -o Date date.o date_amiga.o strtoll.o -liberty -lm
date_amiga.o: private.h tzversion.h
${CC} ${CFLAGS} -DPROG_NAME=\"tzdate\" -c tzversion.c -o date_amiga.o
timezoneinfo_amiga.o: private.h tzversion.h
${CC} ${CFLAGS} -DPROG_NAME=\"TimeZoneInfo\" -c tzversion.c -o timezoneinfo_amiga.o
zic: zic.o zic_amiga.o getopt.o
${CC} ${CFLAGS} -o zic zic.o zic_amiga.o getopt.o
date: date.o date_amiga.o strtoll.o getopt.o
${CC} ${CFLAGS} -o Date date.o date_amiga.o strtoll.o getopt.o -lm
zdump: zdump_amiga.o strtoll.o
${CC} ${CFLAGS} -o ZDump zdump_amiga.o strtoll.o
@@ -43,14 +55,14 @@ zdump: zdump_amiga.o strtoll.o
timezone: timezone.o
${CC} ${CFLAGS} -o TimeZone timezone.o
timezoneinfo: timezoneinfo.o
${CC} ${CFLAGS} -o TimeZoneInfo timezoneinfo.o
timezoneinfo: timezoneinfo.o timezoneinfo_amiga.o
${CC} ${CFLAGS} -o TimeZoneInfo timezoneinfo.o timezoneinfo_amiga.o
setclockgmt: setclockgmt.o
${CC} ${CFLAGS} -o SetClockGMT setclockgmt.o
dstcheck: dstcheck.o
${CC} ${CFLAGS} -o DSTCheck dstcheck.o
dstcheck: dstcheck.o dstcheck_amiga.o
${CC} ${CFLAGS} -o DSTCheck dstcheck.o dstcheck_amiga.o
clean:
rm -f *.o ZDump TimeZone TimeZoneInfo SetClockGMT DSTCheck Date zic
+172 -870
View File
File diff suppressed because it is too large Load Diff
+2 -23
View File
@@ -1,34 +1,13 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <exec/execbase.h>
#include <exec/libraries.h>
#include "tzversion.h"
#include "clib/timezone.h"
#include "inline/timezone.h"
const char *vers = "\0$VER: DSTCheck" AMIGA_VERSION;
struct Library *TimezoneBase;
int main(const int argc, char *argv[])
{
int result;
struct tm tm;
time_t now ;
TimezoneBase = (struct Library*)OpenLibrary((STRPTR)"timezone.library", 0);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 0;
}
time_t now;
amiga_open_libs();
now = time(NULL);
localtime_r(&now, &tm);
result = tm.tm_isdst ? 5 : 0;
CloseLibrary(TimezoneBase);
return result;
}
+117
View File
@@ -0,0 +1,117 @@
/*
* getopt.c --
*
* Standard UNIX getopt function. Code is from BSD.
*
* Copyright (c) 1987-2002 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* A. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* B. 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.
* C. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
*/
/* #if !defined(lint)
* static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94";
* #endif
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "getopt.h"
int opterr = 1, /* if error message should be printed */
optind = 1, /* index into parent argv vector */
optopt, /* character checked for validity */
optreset; /* reset getopt */
char *optarg; /* argument associated with option */
#define BADCH (int)'?'
#define BADARG (int)':'
#define EMSG ""
/*
* getopt --
* Parse argc/argv argument vector.
*/
int
getopt( int nargc,
char * const *nargv,
const char *ostr)
{
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
if (optreset || !*place) { /* update scanning pointer */
optreset = 0;
if (optind >= nargc || *(place = nargv[optind]) != '-') {
place = EMSG;
return (EOF);
}
if (place[1] && *++place == '-') { /* found "--" */
++optind;
place = EMSG;
return (EOF);
}
} /* option letter okay? */
if ((optopt = (int)*place++) == (int)':' ||
!(oli = (char*) strchr(ostr, optopt))) {
/*
* if the user didn't specify '-' as an option,
* assume it means EOF.
*/
if (optopt == (int)'-')
return (EOF);
if (!*place)
++optind;
if (opterr && *ostr != ':')
(void)fprintf(stderr,
"illegal option -- %c\n", optopt);
return (BADCH);
}
if (*++oli != ':') { /* don't need argument */
optarg = NULL;
if (!*place)
++optind;
}
else { /* need an argument */
if (*place) /* no white space */
optarg = place;
else if (nargc <= ++optind) { /* no arg */
place = EMSG;
if (*ostr == ':')
return (BADARG);
if (opterr)
(void)fprintf(stderr,
"option requires an argument -- %c\n",
optopt);
return (BADCH);
}
else /* white space */
optarg = nargv[optind];
place = EMSG;
++optind;
}
return (optopt); /* dump back option letter */
}
+51
View File
@@ -0,0 +1,51 @@
#ifndef _HAD_GETOPT_H
#define _HAD_GETOPT_H
/*
getopt.h -- header for getopt() replacement function
Copyright (C) 1999-2011 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <libzip@nih.at>
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.
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
*/
#ifdef __cplusplus
extern "C" {
#endif
extern char *optarg;
extern int optind;
extern int opterr;
extern int getopt(int, char * const *, const char *);
#ifdef __cplusplus
}
#endif
#endif /* _HAD_GETOPT_H */
+1 -1
View File
@@ -16,7 +16,7 @@
typedef struct timezone* timezone_t;
#endif
#ifndef HAVE_LOCATE_T
#ifndef HAVE_LOCALE_T
typedef struct Locale* locale_t;
#endif
-2
View File
@@ -1,5 +1,3 @@
/* Automatically generated header! Do not edit! */
#ifndef _INLINE_TIMEZONE_H
#define _INLINE_TIMEZONE_H
+6 -197
View File
@@ -1,25 +1,5 @@
//--------------------------------------------------------------------------//
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#ifndef PRIVATE_H
#define PRIVATE_H
/*
** This header is for use ONLY with the time conversion code.
** There is no guarantee that it will remain unchanged,
** or that it will remain at all.
** Do NOT copy it to any system include directory.
** Thank you!
*/
#define GRANDPARENTED "Local time zone must be set--see zic manual page"
/*
** Defaults for preprocessor symbols.
** You can override these in your C compiler options, e.g. '-DHAVE_ADJTIME=0'.
*/
#ifndef TZ_PRIVATE_H
#define TZ_PRIVATE_H
#ifndef HAVE_ADJTIME
#define HAVE_ADJTIME 1
@@ -81,28 +61,9 @@
/* Enable strtoimax on Solaris 10. */
#define __EXTENSIONS__ 1
void tz_cleanup();
/*
** Nested includes
*/
/* Avoid clashes with NetBSD by renaming NetBSD's declarations. */
#define localtime_rz sys_localtime_rz
#define mktime_z sys_mktime_z
#define posix2time_z sys_posix2time_z
#define time2posix_z sys_time2posix_z
#define timezone_t sys_timezone_t
#define tzalloc sys_tzalloc
#define tzfree sys_tzfree
#include <time.h>
#undef localtime_rz
#undef mktime_z
#undef posix2time_z
#undef time2posix_z
#undef timezone_t
#undef tzalloc
#undef tzfree
#ifndef __LONG_LONG_MAX__
#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
#endif
#include "sys/types.h" /* for time_t */
#include "stdio.h"
@@ -297,126 +258,6 @@ typedef unsigned long uintmax_t;
# define restrict /* empty */
#endif
/*
** Workarounds for compilers/systems.
*/
/*
** Compile with -Dtime_tz=T to build the tz package with a private
** time_t type equivalent to T rather than the system-supplied time_t.
** This debugging feature can test unusual design decisions
** (e.g., time_t wider than 'long', or unsigned time_t) even on
** typical platforms.
*/
#ifdef time_tz
# ifdef LOCALTIME_IMPLEMENTATION
static time_t sys_time(time_t *x) {
return time(x);
}
# endif
typedef time_tz tz_time_t;
# undef ctime
# define ctime tz_ctime
# undef ctime_r
# define ctime_r tz_ctime_r
# undef difftime
# define difftime tz_difftime
# undef gmtime
# define gmtime tz_gmtime
# undef gmtime_r
# define gmtime_r tz_gmtime_r
# undef localtime
# define localtime tz_localtime
# undef localtime_r
# define localtime_r tz_localtime_r
# undef localtime_rz
# define localtime_rz tz_localtime_rz
# undef mktime
# define mktime tz_mktime
# undef mktime_z
# define mktime_z tz_mktime_z
# undef offtime
# define offtime tz_offtime
# undef posix2time
# define posix2time tz_posix2time
# undef posix2time_z
# define posix2time_z tz_posix2time_z
# undef time
# define time tz_time
# undef time2posix
# define time2posix tz_time2posix
# undef time2posix_z
# define time2posix_z tz_time2posix_z
# undef time_t
# define time_t tz_time_t
# undef timegm
# define timegm tz_timegm
# undef timelocal
# define timelocal tz_timelocal
# undef timeoff
# define timeoff tz_timeoff
# undef tzalloc
# define tzalloc tz_tzalloc
# undef tzfree
# define tzfree tz_tzfree
# undef tzset
# define tzset tz_tzset
# undef tzsetwall
# define tzsetwall tz_tzsetwall
char *ctime(time_t const *);
char *ctime_r(time_t const *, char *);
double difftime(time_t, time_t);
struct tm *gmtime(time_t const *);
struct tm *gmtime_r(time_t const *restrict, struct tm *restrict);
struct tm *localtime(time_t const *);
struct tm *localtime_r(time_t const *restrict, struct tm *restrict);
time_t mktime(struct tm *);
time_t time(time_t *);
void tzset(void);
#endif
/*
** Some time.h implementations don't declare asctime_r.
** Others might define it as a macro.
** Fix the former without affecting the latter.
*/
#ifndef asctime_r
extern char * asctime_r(struct tm const *restrict, char *restrict);
#endif
/*
** The STD_INSPIRED functions are similar, but most also need
** declarations if time_tz is defined.
*/
#ifdef STD_INSPIRED
# if !defined tzsetwall || defined time_tz
void tzsetwall(void);
# endif
# if !defined offtime || defined time_tz
struct tm *offtime(time_t const *, long);
# endif
# if !defined timegm || defined time_tz
time_t timegm(struct tm *);
# endif
# if !defined timelocal || defined time_tz
time_t timelocal(struct tm *);
# endif
# if !defined timeoff || defined time_tz
time_t timeoff(struct tm *, long);
# endif
# if !defined time2posix || defined time_tz
time_t time2posix(time_t);
# endif
# if !defined posix2time || defined time_tz
time_t posix2time(time_t);
# endif
#endif
/* Infer TM_ZONE on systems where this information is known, but suppress
guessing if NO_TM_ZONE is defined. Similarly for TM_GMTOFF. */
#if (defined __GLIBC__ \
@@ -430,31 +271,6 @@ time_t posix2time(time_t);
# endif
#endif
/*
** Define functions that are ABI compatible with NetBSD but have
** better prototypes. NetBSD 6.1.4 defines a pointer type timezone_t
** and labors under the misconception that 'const timezone_t' is a
** pointer to a constant. This use of 'const' is ineffective, so it
** is not done here. What we call 'struct state' NetBSD calls
** 'struct __state', but this is a private name so it doesn't matter.
*/
#if NETBSD_INSPIRED
typedef struct state *timezone_t;
struct tm *localtime_rz(timezone_t restrict, time_t const *restrict,
struct tm *restrict);
time_t mktime_z(timezone_t restrict, struct tm *restrict);
timezone_t tzalloc(char const *);
void tzfree(timezone_t);
# ifdef STD_INSPIRED
# if !defined posix2time_z || defined time_tz
time_t posix2time_z(timezone_t, time_t) ATTRIBUTE_PURE;
# endif
# if !defined time2posix_z || defined time_tz
time_t time2posix_z(timezone_t, time_t) ATTRIBUTE_PURE;
# endif
# endif
#endif
/*
** Finally, some convenience items.
*/
@@ -534,13 +350,6 @@ static time_t const time_t_max = MAXVAL(time_t, TYPE_BIT(time_t));
# define TZ_DOMAIN "tz"
#endif
#if HAVE_INCOMPATIBLE_CTIME_R
#undef asctime_r
#undef ctime_r
char *asctime_r(struct tm const *, char *);
char *ctime_r(time_t const *, char *);
#endif /* HAVE_INCOMPATIBLE_CTIME_R */
#ifndef YEARSPERREPEAT
#define YEARSPERREPEAT 400 /* years before a Gregorian repeat */
#endif /* !defined YEARSPERREPEAT */
@@ -561,4 +370,4 @@ char *ctime_r(time_t const *, char *);
#define SECSPERREPEAT_BITS 34 /* ceil(log2(SECSPERREPEAT)) */
#endif /* !defined SECSPERREPEAT_BITS */
#endif /* !defined PRIVATE_H */
#endif /* !defined TZ_PRIVATE_H */
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <stdlib.h>
#include "tzversion.h"
+2 -2
View File
@@ -1,5 +1,5 @@
#ifndef __STDINT_H
#define __STDINT_H 1
#ifndef TZ_STDINT_H
#define TZ_STDINT_H 1
#if 0
typedef signed char int8_t;
+40 -7
View File
@@ -43,13 +43,6 @@
#include "tzversion.h"
extern struct Locale* locale;
#define isalpha(c) IsAlpha(locale, (ULONG)c)
#define isupper(c) IsUpper(locale, (ULONG)c)
#define isdigit(c) IsDigit(locale, (ULONG)c)
#define isspace(c) IsSpace(locale, (ULONG)c)
#ifndef LLONG_MAX
#define LLONG_MAX ((long long)(~0ULL>>1))
#endif
@@ -57,6 +50,46 @@ extern struct Locale* locale;
#define LLONG_MIN (-LLONG_MAX - 1)
#endif
#define isupper(x) ((unsigned)(x)-'A'<='Z'-'A')
int isdigit(char c)
{
switch (c) {
default:
return 0;
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9': case '0':
return 1;
}
}
int isspace(char c)
{
switch (c) {
default:
return 0;
case '\t': case '\r': case '\n': case '\v': case '\f': case ' ':
return 1;
}
}
int isalpha(char c)
{
switch (c) {
default:
return 0;
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G':
case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N':
case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U':
case 'V': case 'W': case 'X': case 'Y': case 'Z':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g':
case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n':
case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u':
case 'v': case 'w': case 'x': case 'y': case 'z':
return 1;
}
}
long long int strtoll(const char *nptr, char **endptr, int base)
{
const char *s;
+7 -8
View File
@@ -1,14 +1,9 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include "tzversion.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "zone.h"
#include "tzversion.h"
#include "clib/timezone.h"
#include "inline/timezone.h"
const char *vers = "\0$VER: TimeZone" AMIGA_VERSION;
@@ -279,7 +274,10 @@ void set_tz(char *newtz)
void use_tz()
{
long checked;
struct timeval tv;
gettimeofday(&tv, NULL);
if (tz != NULL) {
stou(tz);
SetVar((STRPTR)TZVARIABLE, (STRPTR)tz, strlen(tz) + 1, GVF_GLOBAL_ONLY);
@@ -290,6 +288,7 @@ void use_tz()
}
tzset();
settimeofday(&tv, NULL);
}
}
+1 -21
View File
@@ -1,18 +1,4 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <exec/memory.h>
#include <exec/execbase.h>
#include <exec/libraries.h>
#include "tzversion.h"
#include "clib/timezone.h"
#include "inline/timezone.h"
const char *vers = "\0$VER: TimeZoneInfo" AMIGA_VERSION;
struct Library *TimezoneBase;
int main(const int argc, char *argv[])
{
@@ -24,12 +10,7 @@ int main(const int argc, char *argv[])
time_t now ;
const char* loc;
TimezoneBase = (struct Library*)OpenLibrary((STRPTR)"timezone.library", 0);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 5;
}
amiga_open_libs();
now = time(NULL);
localtime_r(&now, &tm);
@@ -47,6 +28,5 @@ int main(const int argc, char *argv[])
FPrintf(Output(), (STRPTR)"It is not daylight-saving time.\n");
}
CloseLibrary(TimezoneBase);
return 0;
}
+45
View File
@@ -0,0 +1,45 @@
#include "tzversion.h"
#include <stdlib.h>
const char *vers = AMIGA_VERSION_STRING;
char ** environ = NULL;
struct Library *DOSBase = NULL;
struct Library *TimezoneBase = NULL;
void amiga_open_lib_error(char *name, int version)
{
FPrintf(Output(), (STRPTR)OPEN_VER_ERROR, name, version);
}
void amiga_close_libs()
{
if (TimezoneBase != NULL) {
CloseLibrary(TimezoneBase);
TimezoneBase = NULL;
}
if (DOSBase != NULL) {
CloseLibrary(DOSBase);
DOSBase = NULL;
}
}
int amiga_open_libs()
{
atexit(amiga_close_libs);
DOSBase = OpenLibrary((STRPTR)DOSLIB_NAME, DOSLIB_REV);
if(!DOSBase) {
amiga_open_lib_error(DOSLIB_NAME, DOSLIB_REV);
return 5;
}
TimezoneBase = OpenLibrary((CONST_STRPTR)TIMEZONELIB_NAME, TIMEZONELIB_REV);
if(!TimezoneBase) {
amiga_open_lib_error(TIMEZONELIB_NAME, TIMEZONELIB_REV);
return 5;
}
return 0;
}
+15 -7
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#ifndef TZ_VERSION_H
#define TZ_VERSION_H
#if defined(__amiga__) || defined(__AMIGA__) || defined(__amigaos4__) || \
@@ -38,6 +34,7 @@
# define HAVE_LINK 0
# define HAVE_SYMLINK 0
# define HAVE_SYS_STAT_H 0
# define HAVE_INTTYPES_H 0
# define HAVE_TIME_T 1
# define HAVE_TIMEVAL 1
# define HAVE_STDINT_H 1
@@ -83,6 +80,9 @@
#include <clib/battclock_protos.h>
#include <resources/battclock.h>
#include "clib/timezone.h"
#include "inline/timezone.h"
#define OPEN_ERROR "Cannot open %s.\n"
#define OPEN_VER_ERROR "Cannot open %s (%ld.0)\n"
@@ -97,7 +97,7 @@
#define DOSLIB_NAME "dos.library"
#define DOSLIB_REV 37L
#define TIMEZONELIB_NAME "timezone.library"
#define TIMEZONELIB_REV 4L
#define TIMEZONELIB_REV 5L
#define TIMER_NAME TIMERNAME
#define BATTCLOCK_NAME BATTCLOCKNAME
#define PUBSCREEN_NAME "PubScreen"
@@ -112,20 +112,28 @@
#define XSTR(s) STR(s)
#define STR(s) #s
#define VERSION_NO 4
#define VERSION_NO 5
#define VERSION XSTR(VERSION_NO)
#define REVISION_NO 00
#define REVISION XSTR(REVISION_NO)
#define DATE "05.10.2016"
#define DATE "15.10.2016"
#define PACKAGE_TZ "tzcode"
#define VERSION_TZ "2016g"
#define BUGEMAIL_TZ "cs@innolan.dk"
#define AMIGA_VERSION " " VERSION "." REVISION " (" DATE ") " \
PACKAGE_TZ " " VERSION_TZ
#define AMIGA_VERSION_STRING "\0$VER: " PROG_NAME AMIGA_VERSION;
static char const PKGVERSION[] = "(" PACKAGE_TZ ")";
static char const TZVERSION[] = VERSION_TZ;
static char const REPORT_BUGS_TO[] = BUGEMAIL_TZ;
struct Library *DOSBase;
struct Library *TimezoneBase;
int amiga_open_libs();
long long int strtoll(const char *nptr, char **endptr, int base);
#endif
#endif
-5
View File
@@ -1,8 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "tzversion.h"
#include "clib/timezone.h"
#include "inline/timezone.h"
-4
View File
@@ -1,7 +1,3 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#ifndef TZ_ZONE_H
#define TZ_ZONE_H