Version 2.00 changes

This commit is contained in:
llsth
2015-07-29 20:14:38 +02:00
parent 821179b66f
commit 74189899e2
103 changed files with 5133 additions and 4306 deletions
+5
View File
@@ -0,0 +1,5 @@
*.o
*.library
*.debug
*.map
*.kdev4
+6
View File
@@ -0,0 +1,6 @@
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
+39 -15
View File
@@ -1,32 +1,56 @@
all: localtime gmtime date1 date2
all: date1 date2 gmtime localtime nyc strftime strftime2 strptime time
CC = m68k-amigaos-gcc
CFLAGS = -O2 -noixemul -I../utility/include -Wall -Werror
AR = m68k-amigaos-ar
LIBS =
localtime.o: localtime.c
gmtime.o: gmtime.c
date1.o: date1.c
date2.o: date2.c
localtime: localtime.o
${CC} ${CFLAGS} -o localtime localtime.o
gmtime: gmtime.o
${CC} ${CFLAGS} -o gmtime gmtime.o
date1: date1.o
${CC} ${CFLAGS} -o date1 date1.o
date2.o: date2.c
date2: date2.o
${CC} ${CFLAGS} -o date2 date2.o
gmtime.o: gmtime.c
gmtime: gmtime.o
${CC} ${CFLAGS} -o gmtime gmtime.o
localtime.o: localtime.c
localtime: localtime.o
${CC} ${CFLAGS} -o localtime localtime.o
nyc.o: nyc.c
nyc: nyc.o
${CC} ${CFLAGS} -o nyc nyc.o
strftime.o: strftime.c
strftime: strftime.o
${CC} ${CFLAGS} -o strftime strftime.o
strftime2.o: strftime2.c
strftime2: strftime2.o
${CC} ${CFLAGS} -o strftime2 strftime2.o
strptime.o: strptime.c
strptime: strptime.o
${CC} ${CFLAGS} -o strptime strptime.o
time.o: time.c
time: time.o
${CC} ${CFLAGS} -o time time.o
clean:
rm -f *.o localtime gmtime date1 date2
rm -f *.o date1 date2 gmtime localtime nyc strftime strftime2 strptime time
depend:
@echo Dependencies already done
+7 -32
View File
@@ -1,44 +1,21 @@
/*
* 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. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
#include "inline/timezone.h"
struct Library *TimezoneBase;
int main(const int argc, char *argv[])
int main()
{
time_t rawtime;
struct tm *info;
char buffer[80];
TimezoneBase = OpenLibrary("timezone.library", 0);
TimezoneBase = OpenLibrary("timezone.library", 2L);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 5;
@@ -46,11 +23,9 @@ int main(const int argc, char *argv[])
time(&rawtime);
info = localtime(&rawtime);
strftime(buffer,80,"%x - %I:%M%p", info);
printf("Formatted date & time : |%s|\n", buffer );
strftime(buffer,80,"%+", info);
printf("%s\n", buffer);
CloseLibrary(TimezoneBase);
return 0;
}
+6 -59
View File
@@ -1,44 +1,21 @@
/*
* 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. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
#include "inline/timezone.h"
struct Library *TimezoneBase;
int main(const int argc, char *argv[])
int main()
{
time_t rawtime;
struct tm *info;
char buffer[80];
TimezoneBase = OpenLibrary("timezone.library", 0);
TimezoneBase = OpenLibrary("timezone.library", 2L);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 5;
@@ -46,39 +23,9 @@ int main(const int argc, char *argv[])
time(&rawtime);
info = localtime(&rawtime);
//////////////////////////////////////
printf("Non localized:\n");
strftime(buffer,80,"%c", info);
printf("%%c :%s\n", buffer );
strftime(buffer,80,"%x", info);
printf("%%x :%s\n", buffer );
strftime(buffer,80,"%X", info);
printf("%%X :%s\n", buffer );
strftime(buffer,80,"%+", info);
printf("%%+ :%s\n", buffer );
//////////////////////////////////////
printf("\nLocalized:\n");
strftime_l(buffer,80,"%c", info, NULL);
printf("%%c :%s\n", buffer );
strftime_l(buffer,80,"%x", info, NULL);
printf("%%x :%s\n", buffer );
strftime_l(buffer,80,"%X", info, NULL);
printf("%%X :%s\n", buffer );
strftime_l(buffer,80,"%+", info, NULL);
printf("%%+ :%s\n", buffer );
//////////////////////////////////////
printf("%s\n", buffer);
CloseLibrary(TimezoneBase);
return 0;
}
+4 -28
View File
@@ -1,32 +1,9 @@
/*
* 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. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
#include "inline/timezone.h"
@@ -40,7 +17,7 @@ int main ()
time_t rawtime;
struct tm *info;
TimezoneBase = OpenLibrary("timezone.library", 0);
TimezoneBase = OpenLibrary("timezone.library", 2L);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 5;
@@ -54,6 +31,5 @@ int main ()
printf("China (Fixed CCT = GMT +8) : %2d:%02d\n", (info->tm_hour+CCT)%24, info->tm_min);
CloseLibrary(TimezoneBase);
return 0;
}
+5 -29
View File
@@ -1,43 +1,20 @@
/*
* 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. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
#include "inline/timezone.h"
struct Library *TimezoneBase;
int main(const int argc, char *argv[])
int main()
{
time_t rawtime;
struct tm *info;
TimezoneBase = OpenLibrary("timezone.library", 0);
TimezoneBase = OpenLibrary("timezone.library", 2L);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 5;
@@ -48,6 +25,5 @@ int main(const int argc, char *argv[])
printf("%s", asctime(info));
CloseLibrary(TimezoneBase);
return 0;
}
+40
View File
@@ -0,0 +1,40 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
#include "inline/timezone.h"
struct Library *TimezoneBase;
int main()
{
time_t rawtime;
struct tm info;
timezone_t timezone;
char *name = "America/New_York";
TimezoneBase = OpenLibrary("timezone.library", 2L);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 5;
}
time(&rawtime);
timezone = tzalloc(name);
if (timezone != NULL) {
localtime_rz(timezone, &rawtime, &info);
underscore_remove(name);
printf("Time in %s is:\n", name);
printf("%s", asctime(&info));
tzfree(timezone);
} else {
printf("Cannot open timezone: %s\n", name);
}
CloseLibrary(TimezoneBase);
return 0;
}
+51
View File
@@ -0,0 +1,51 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
#include "inline/timezone.h"
struct Library *TimezoneBase;
int main(const int argc, char *argv[])
{
time_t rawtime;
struct tm *info;
char buffer[80];
TimezoneBase = OpenLibrary("timezone.library", 2L);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 5;
}
time(&rawtime);
info = localtime(&rawtime);
printf("strftime examples.\n\n");
printf("Globalized:\n");
strftime(buffer,80,"%c", info);
printf("%%c :%s\n", buffer);
strftime(buffer,80,"%x", info);
printf("%%x :%s\n", buffer);
strftime(buffer,80,"%X", info);
printf("%%X :%s\n", buffer);
strftime(buffer,80,"%+", info);
printf("%%+ :%s\n", buffer);
printf("\nLocalized:\n");
strftime_l(buffer,80,"%c", info, NULL);
printf("%%c :%s\n", buffer);
strftime_l(buffer,80,"%x", info, NULL);
printf("%%x :%s\n", buffer);
strftime_l(buffer,80,"%X", info, NULL);
printf("%%X :%s\n", buffer);
strftime_l(buffer,80,"%+", info, NULL);
printf("%%+ :%s\n", buffer);
CloseLibrary(TimezoneBase);
return 0;
}
+34
View File
@@ -0,0 +1,34 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
#include "inline/timezone.h"
struct Library *TimezoneBase;
int main(const int argc, char *argv[])
{
time_t rawtime;
struct tm *info;
char buffer[80];
TimezoneBase = OpenLibrary("timezone.library", 2L);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 5;
}
time(&rawtime);
info = localtime(&rawtime);
printf("strftime %%x - %%I:%%M%%p\n");
strftime(buffer,80,"%x - %I:%M%p", info);
printf("Formatted date & time : %s\n", buffer);
CloseLibrary(TimezoneBase);
return 0;
}
+34
View File
@@ -0,0 +1,34 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h> // printf
#include <string.h> // memset
//#include <time.h> // POSIX include file
#include "clib/timezone.h" // strptime, asctime
#include "inline/timezone.h"
#include <proto/exec.h> // OpenLibrary, CloseLibrary
struct Library *TimezoneBase;
int main()
{
struct tm tm;
memset(&tm, 0, sizeof(struct tm));
TimezoneBase = OpenLibrary("timezone.library", 2L);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 5;
}
printf(
"strptime with args '2000-12-13 14:15:16', "
"'%%Y-%%m-%%d %%H:%%M:%%S'\n");
strptime("2000-12-13 14:15:16", "%Y-%m-%d %H:%M:%S", &tm);
printf("Time is %s", asctime(&tm));
CloseLibrary(TimezoneBase);
return 0;
}
+27
View File
@@ -0,0 +1,27 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
#include "inline/timezone.h"
struct Library *TimezoneBase;
int main()
{
time_t rawtime;
TimezoneBase = OpenLibrary("timezone.library", 2L);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 5;
}
time(&rawtime);
printf("Rawtime (time): %ld\n", (long)rawtime);
CloseLibrary(TimezoneBase);
return 0;
}
+19 -4
View File
@@ -1,7 +1,7 @@
@database tzc.guide
@author Carsten Larsen
@(c) Carsten Larsen
@$VER: tz.guide 1.03 (25.07.2015)
@$VER: tz.guide 2.00 (30.07.2015)
@node Main "Amiga time zone database"
@title "Amiga time zone database"
@@ -21,10 +21,11 @@ time zone boundaries, UTC offsets, and daylight-saving rules.
@{"TimeZoneInfo " link "TimeZoneInfo"} Show active time zone
@{"SetClockGMT " link "SetClockGMT"} Set battery backed-up hardware clock in GMT
@{"DSTCheck " link "DSTCheck"} Warn when daylight saving time changes
@{"ZDump " link "ZDump"} Time zone dumper
@{b}DEVELOPER MANUALS@{ub}
@{"ZDump " link "ZDump"} Time zone dumper
@{"Library " link "library"} Time zone library
@{"Zic " link "zic"} Time zone compiler
@{"tzfile " link "tzfile"} Time zone information
@@ -50,7 +51,6 @@ Optionally
* Copy TimeZone to your systems SYS:Prefs
* Copy Zoneinfo to LOCALE:Zoneinfo
* Copy files in Help to LOCALE:Help/TimeZone
* Copy files in Developer to your GCC environment
* Assign ZONEINFO: to LOCALE:Zoneinfo in S:Startup-Sequence
* Add SetClockGMT <NIL: >NIL: LOAD to end of S:Startup-Sequence
@@ -68,7 +68,7 @@ Add SetClockGMT LOAD to end of S:Startup-Sequence
Validate time zone preferences in shell:
TimeZoneInfo
Show other time in other time zones:
Show time in other time zones:
Execute example/misc
@@ -262,6 +262,21 @@ proposing and distributing patches is via email as illustrated above.
@{bg filltext}@{b} July 25, 2015 DSTCheck@{ub}@{bg background}
@endnode
@node library "Timezone Library"
@title "Timezone Library"
@{b}timezone.library@{ub}
Version 2 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
@endnode
@node ZDump "ZDump user manual"
@title "ZDump user manual"
+53 -49
View File
@@ -6,19 +6,13 @@ CC = m68k-amigaos-gcc
CFLAGS = -O2 -noixemul -Iinclude -Wall -Werror
LDLIBS = -lgcc -lnix
lib_base.h: lib_user.h
touch lib_base.h
lib_user.h: compiler.h lib_macros.h
touch lib_user.h
time_proto.h: compiler.h lib_macros.h time_state.h time_tm.h time_types.h
touch time_proto.h
time_local.h: time_header.h
touch time_local.h
time_rule.h: time_types.h
touch time_rule.h
time_state.h: compiler.h time_types.h time_tzfile.h
time_state.h: time_header.h time_tzfile.h
touch time_state.h
time_types.h: compiler.h
@@ -27,11 +21,15 @@ time_types.h: compiler.h
time_tzfile.h: compiler.h
touch time_tzfile.h
lib_base.o: lib_base.c compiler.h lib_base.h lib_macros.h time_proto.h time_version.h
ctype_isdigit.o: ctype_isdigit.c
lib_mem.o: lib_mem.c compiler.h lib_mem.h
ctype_isspace.o: ctype_isspace.c
lib_user.o: lib_user.c compiler.h lib_user.h time_proto.h time_state.h
ctype_toupper.o: ctype_toupper.c
lib_base.o: lib_base.c lib.h time_header.h time_version.h
lib_user.o: lib_user.c lib.h time_header.h
string_bcopy.o: string_bcopy.c compiler.h
@@ -49,84 +47,90 @@ string_strcpy.o: string_strcpy.c
string_strlen.o: string_strlen.c
string_underscore.o: string_underscore.c lib_macros.h
string_strncmp.o: string_strncmp.c compiler.h
time_asctime.o: time_asctime.c compiler.h lib_macros.h time_proto.h time_tm.h time_types.h time_tzfile.h
strings_strncasecmp.o: strings_strncasecmp.c compiler.h time_header.h
time_ctime.o: time_ctime.c compiler.h lib_macros.h time_proto.h time_state.h time_tm.h time_types.h
time_asctime.o: time_asctime.c time_header.h
time_difftime.o: time_difftime.c lib_macros.h time_tm.h time_types.h
time_ctime.o: time_ctime.c time_header.h
time_gmtcheck.o: time_gmtcheck.c compiler.h lib_mem.h time_proto.h
time_difftime.o: time_difftime.c time_header.h
time_gmtime.o: time_gmtime.c lib_macros.h time_proto.h time_tm.h
time_gmtcheck.o: time_gmtcheck.c time_header.h
time_gmtload.o: time_gmtload.c time_proto.h time_state.h
time_gmtime.o: time_gmtime.c time_header.h
time_gmtsub.o: time_gmtsub.c time_proto.h time_types.h
time_gmtload.o: time_gmtload.c time_header.h
time_increment_ot.o: time_increment_ot.c compiler.h time_types.h
time_gmtsub.o: time_gmtsub.c time_header.h
time_init_ttinfo.o: time_init_ttinfo.c time_state.h time_types.h
time_increment_ot.o: time_increment_ot.c time_header.h
time_init_ttinfo.o: time_init_ttinfo.c time_header.h
time_length.o: time_length.c time_length.h
time_localsub.o: time_localsub.c time_length.h time_proto.h time_tm.h
time_local.o: time_local.c time_header.h time_local.h
time_localtime.o: time_localtime.c lib_macros.h time_proto.h time_state.h time_tm.h time_types.h
time_localsub.o: time_localsub.c time_header.h
time_localtime_tzset.o: time_localtime_tzset.c compiler.h time_proto.h time_state.h time_tm.h time_types.h
time_localtime.o: time_localtime.c time_header.h
time_lock.o: time_lock.c compiler.h
time_localtime_tzset.o: time_localtime_tzset.c time_header.h
time_mktime.o: time_mktime.c lib_macros.h time_proto.h time_tm.h
time_lock.o: time_lock.c time_header.h
time_mktime_tzname.o: time_mktime_tzname.c time_length.h time_proto.h time_tm.h time_types.h
time_mktime.o: time_mktime.c time_header.h
time_settzname.o: time_settzname.c time_proto.h time_state.h time_types.h
time_mktime_tzname.o: time_mktime_tzname.c time_header.h
time_state.o: time_state.c compiler.h time_state.h time_types.h
time_settzname.o: time_settzname.c time_header.h
time_strftime.o: time_strftime.c compiler.h lib_macros.h time_proto.h time_tm.h time_types.h time_tzfile.h
time_state.o: time_state.c time_header.h
time_time.o: time_time.c compiler.h lib_macros.h time_proto.h
time_strftime.o: time_strftime.c time_header.h time_local.h
time_timer.o: time_timer.c compiler.h lib_mem.h time_types.h
time_strptime.o: time_strptime.c time_header.h time_local.h
time_timesub.o: time_timesub.c compiler.h time_length.h time_proto.h time_state.h time_types.h
time_time.o: time_time.c time_header.h
time_tzalloc.o: time_tzalloc.c compiler.h time_proto.h time_state.h time_tm.h
time_timer.o: time_timer.c time_header.h
time_tzfree.o: time_tzfree.c compiler.h lib_macros.h lib_mem.h time_state.h
time_timesub.o: time_timesub.c time_header.h
time_tzload.o: time_tzload.c compiler.h lib_mem.h time_length.h time_proto.h time_types.h
time_tzalloc.o: time_tzalloc.c time_header.h
time_tzlocation.o: time_tzlocation.c compiler.h lib_macros.h time_state.h
time_tzfree.o: time_tzfree.c time_header.h
time_tzparse.o: time_tzparse.c time_length.h time_proto.h time_rule.h time_state.h time_tzfile.h
time_tzload.o: time_tzload.c time_header.h
time_tzset.o: time_tzset.c time_proto.h
time_tzlocation.o: time_tzlocation.c time_header.h
time_tzset_unlock.o: time_tzset_unlock.c compiler.h lib_mem.h time_proto.h
time_tzparse.o: time_tzparse.c time_header.h time_rule.h
time_tzsetlcl.o: time_tzsetlcl.c compiler.h lib_mem.h time_proto.h time_state.h
time_tzset.o: time_tzset.c time_header.h
time_updata_tzname_etc.o: time_updata_tzname_etc.c time_state.h time_types.h
time_tzset_unlock.o: time_tzset_unlock.c time_header.h
time_zoneinit.o: time_zoneinit.c time_proto.h time_state.h time_types.h
time_tzsetlcl.o: time_tzsetlcl.c time_header.h
time_updata_tzname_etc.o: time_updata_tzname_etc.c time_header.h
time_zoneinit.o: time_zoneinit.c time_header.h
lib: timezone.library timezone.library.debug
timezone.library: lib_base.o lib_mem.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_underscore.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_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_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 $@ lib_base.o lib_mem.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_underscore.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_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_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_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.debug: lib_base.o lib_mem.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_underscore.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_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_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 $@ lib_base.o lib_mem.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_underscore.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_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_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_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) \
-Wl,--cref,-M,-Map=timezone.library.map -nostartfiles -nostdlib ${LDLIBS}
clean:
rm -f lib_base.o lib_mem.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_underscore.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_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_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_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
depend:
@echo Dependencies already done
+28 -25
View File
@@ -1,12 +1,13 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#ifndef _ZONEINFO_COMPILER_H
#define _ZONEINFO_COMPILER_H
//--------------------------------------------------------------------------//
#include <exec/types.h>
#include <exec/memory.h>
//--------------------------------------------------------------------------//
#if __STDC_VERSION__ < 199901
# define true 1
# define false 0
@@ -14,24 +15,28 @@
#else
# include <stdbool.h>
#endif
//--------------------------------------------------------------------------//
//#include <stdint.h>
typedef unsigned long long int uint64_t;
#include <stddef.h>
//typedef long unsigned int size_t;
//--------------------------------------------------------------------------//
#include <sys/types.h>
//typedef unsigned long time_t;
//--------------------------------------------------------------------------//
#define TIME_MAX ULONG_MAX
typedef struct state *timezone_t;
//--------------------------------------------------------------------------//
#include <libraries/locale.h>
typedef struct Locale *locale_t;
//--------------------------------------------------------------------------//
// Address is neither aligned to a word or long word boundary.
#define IS_UNALIGNED(a) ((((unsigned long)(a)) & 1) != 0)
//--------------------------------------------------------------------------//
// Address is aligned to a word boundary, but not to a long word boundary.
#define IS_SHORT_ALIGNED(a) ((((unsigned long)(a)) & 3) == 2)
//--------------------------------------------------------------------------//
// Address is aligned to a long word boundary. For an 68030 and beyond the
// alignment does not matter.
#if defined(M68020)
@@ -39,43 +44,41 @@ typedef struct Locale *locale_t;
#else
# define IS_LONG_ALIGNED(a) ((((unsigned long)(a)) & 3) == 0)
#endif
//--------------------------------------------------------------------------//
#define FILENAME_MAX 1024
#define ENVSIZE 256
//--------------------------------------------------------------------------//
#define __NOLIBBASE__
#define __NOGLOBALIFACE__
#define __USE_INLINE__
//--------------------------------------------------------------------------//
#define DOSBase __DOSBase
#define MathIeeeDoubBasBase __MathIeeeDoubBasBase
#define UtilityBase __UtilityBase
//--------------------------------------------------------------------------//
#include "inline/dos.h"
#include "inline/alib.h"
#include "inline/exec.h"
#include "inline/timer.h"
#include "inline/locale.h"
//--------------------------------------------------------------------------//
extern struct ExecBase* SysBase;
extern struct Library* DOSBase;
extern struct Library* UtilityBase;
extern struct Library* MathIeeeDoubBasBase;
extern struct Library* LocaleBase;
extern struct Device* TimerBase;
extern struct timerequest* TimeRequest;
extern struct SignalSemaphore TimeSemaphore;
//--------------------------------------------------------------------------//
#define DOSLIB_NAME "dos.library"
#define MATHLIB_NAME "mathieeedoubbas.library"
#define UTILLIB_NAME "utility.library"
#define LOCALELIB_NAME "locale.library"
#define TIMER_NAME "timer.device"
#define LIB_VERSION 37L
//--------------------------------------------------------------------------//
#define TZVARIABLE "timezone.prefs"
#define TZDIR "ZONEINFO:"
#define TZDEFAULT "localtime"
#define TZDEFRULES "posixrules"
//--------------------------------------------------------------------------//
extern struct ExecBase* SysBase;
extern struct Library* DOSBase;
extern struct Library* UtilityBase;
extern struct Library* MathIeeeDoubBasBase;
extern struct Library* LocaleBase;
extern struct SignalSemaphore TimeSemaphore;
#endif
+9 -60
View File
@@ -29,12 +29,10 @@
set -e
HDRS='
lib_base.h
lib.h
lib_macros.h
lib_mem.h
lib_user.h
time_length.h
time_proto.h
time_local.h
time_rule.h
time_state.h
time_tm.h
@@ -44,8 +42,10 @@ HDRS='
'
SRCS='
ctype_isdigit.c
ctype_isspace.c
ctype_toupper.c
lib_base.c
lib_mem.c
lib_user.c
string_bcopy.c
string_memcpy.c
@@ -55,7 +55,8 @@ SRCS='
string_strcmp.c
string_strcpy.c
string_strlen.c
string_underscore.c
string_strncmp.c
strings_strncasecmp.c
time_asctime.c
time_ctime.c
time_difftime.c
@@ -66,6 +67,7 @@ SRCS='
time_increment_ot.c
time_init_ttinfo.c
time_length.c
time_local.c
time_localsub.c
time_localtime.c
time_localtime_tzset.c
@@ -75,6 +77,7 @@ SRCS='
time_settzname.c
time_state.c
time_strftime.c
time_strptime.c
time_time.c
time_timer.c
time_timesub.c
@@ -92,24 +95,6 @@ SRCS='
#################################################
SRCS1='
main_amiga_client.c
'
SRCS2='
main_amiga_poll.c
'
SRCS3='
main_amiga_sim.c
'
SRCS4='
main_amiga_test.c
'
#################################################
if make -v 2>&1 | grep GNU > /dev/null 2>&1 ; then
echo "make is GNU make."
VALID=true
@@ -167,32 +152,6 @@ if $VALID ; then
l="${l} ${b}.o"
done
#################################################
# BIN1=""
# for f in ${SRCS1}
# do
# BIN1="${BIN1} `basename $f .c`.o"
# done
# BIN2=""
# for f in ${SRCS2}
# do
# BIN2="${BIN2} `basename $f .c`.o"
# done
# BIN3=""
# for f in ${SRCS3}
# do
# BIN3="${BIN3} `basename $f .c`.o"
# done
# BIN4=""
# for f in ${SRCS4}
# do
# BIN4="${BIN4} `basename $f .c`.o"
# done
#################################################
echo
echo "lib: timezone.library timezone.library.debug"
echo
@@ -204,17 +163,7 @@ if $VALID ; then
echo " \$(CC) -o \$@ ${l} \$(CFLAGS) \\"
echo " -Wl,--cref,-M,-Map=timezone.library.map -nostartfiles -nostdlib \${LDLIBS}"
# echo " -Wl,--cref,-M,-Map=timezone.library.map -nostartfiles \${LDLIBS}"
echo
# echo "ntimed-poll: ${BIN2}"
# echo " \${CC} \${CFLAGS} -o ntimed-poll ${BIN2} \${LDLIBS}"
# echo
# echo "ntimed-sim: ${BIN3}"
# echo " \${CC} \${CFLAGS} -o ntimed-sim ${BIN3} \${LDLIBS}"
# echo
# echo "ntimed-test: ${BIN4}"
# echo " \${CC} \${CFLAGS} -o ntimed-test ${BIN4} \${LDLIBS}"
# echo
echo "clean:"
echo " rm -f ${l} timezone.library timezone.library.debug timezone.library.map"
echo
+35
View File
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
* 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.
* 3. Neither the name of Olaf Barthel nor the names of 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 COPYRIGHT OWNER 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.
*
*/
int isdigit(int c)
{
return ('0' <= c && c <= '9');
}
+40
View File
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
* 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.
* 3. Neither the name of Olaf Barthel nor the names of 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 COPYRIGHT OWNER 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.
*
*/
int isspace(int c)
{
return (c == '\t' ||
c == '\r' ||
c == '\n' ||
c == '\v' ||
c == '\f' ||
c == ' ');
}
+35
View File
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
* 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.
* 3. Neither the name of Olaf Barthel nor the names of 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 COPYRIGHT OWNER 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.
*
*/
int toupper(int c)
{
return ('a' <= c && c <= 'z') ? (c - ('a' - 'A')) : c;
}
+12 -5
View File
@@ -14,16 +14,23 @@ char* ctime_r(const time_t *const timep, char *buf);
double difftime(const time_t time1, const time_t time0);
char* asctime(const struct tm *timeptr);
char* asctime_r(const struct tm *timeptr, char *buf);
size_t strftime(char * const s, 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);
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();
long timezone_c();
long altzone_c();
char** tzname_c();
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);
+6
View File
@@ -19,6 +19,12 @@ 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)
daylight_c()()
timezone_c()()
altzone_c()()
tzname_c()()
getsystime(tv)(a0)
setsystime(tv)(a0)
gettimeofday(tv,tz)(a0/a1)
+28 -10
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,21 +28,20 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
#ifndef _LIB_TIME_BASE_H
#define _LIB_TIME_BASE_H
//--------------------------------------------------------------------------//
#ifndef _TIME_LIB_H
#define _TIME_LIB_H
#ifndef STATIC_LIBRARY
#include <exec/execbase.h>
#include <exec/libraries.h>
#include <exec/semaphores.h>
#include <dos/dos.h>
#include "lib_user.h"
//--------------------------------------------------------------------------//
#if defined(USE_EXEC)
# undef USE_EXEC
#endif
//--------------------------------------------------------------------------//
#if defined(__amigaos4__)
# define USE_EXEC(sb) \
struct ExecIFace * IExec = (sb)->sb_IExec
@@ -56,7 +54,7 @@
# define USE_LIBBASE(base) \
struct TimezoneBase * sb = (struct TimezoneBase *)(base)
#endif
//--------------------------------------------------------------------------//
struct TimezoneBase
{
struct Library sb_Library;
@@ -68,5 +66,25 @@ struct TimezoneBase
#endif
struct UserData* sb_UserData;
};
//--------------------------------------------------------------------------//
struct UserData
{
struct Library* ud_SysBase;
#if defined(__amigaos4__)
struct ExecIFace* ud_IExec;
#endif
struct TimezoneBase* ud_ZoneinfoBase;
ULONG ud_UseCount;
};
bool UserLibInit(
struct Library *SysBase,
struct TimezoneBase *sb,
struct UserData *ud);
bool UserLibOpen(struct UserData *ud);
void UserLibClose(struct UserData *ud);
void UserLibExpunge(struct UserData *ud);
#endif /* STATIC_LIBRARY */
#endif
+30 -33
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,33 +28,31 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "lib_base.h"
#include "lib_macros.h"
#include "time_proto.h"
#include "time_header.h"
#include "time_version.h"
//--------------------------------------------------------------------------//
#include "lib.h"
#include <exec/execbase.h>
#include <exec/resident.h>
#include <exec/libraries.h>
#include <exec/memory.h>
#include <dos/dos.h>
//--------------------------------------------------------------------------//
LONG _start(VOID);
//--------------------------------------------------------------------------//
STATIC struct TimezoneBase *ASM lib_init(REG(d0,struct TimezoneBase *sb),REG(a0,BPTR segment_list),REG(a6,APTR whatever));
STATIC struct TimezoneBase *ASM lib_open(REG(a6,APTR base));
STATIC BPTR ASM lib_expunge(REG(a6,APTR base));
STATIC BPTR ASM lib_close(REG(a6,APTR base));
//--------------------------------------------------------------------------//
#if defined(__amigaos4__)
STATIC ULONG lib_default_obtain(struct Interface *self);
STATIC ULONG lib_default_release(struct Interface *self);
#else
STATIC LONG lib_reserved(VOID);
#endif
//--------------------------------------------------------------------------//
/* This is the first executable location of the library. It must return
an error to the unsuspecting caller who tries to run it as a program. */
LONG
@@ -64,7 +61,6 @@ _start(VOID)
return(-1);
}
//--------------------------------------------------------------------------//
/* This routine is called after the library has been loaded into
memory and its base data structure has been created. Here we
must initialize those parts of the base data structure which
@@ -88,7 +84,7 @@ _start(VOID)
This routine must return the Library base pointer if it succeeds.
Failure is indicated by returning NULL instead. */
//--------------------------------------------------------------------------//
STATIC struct TimezoneBase * ASM
lib_init(
REG(d0, struct TimezoneBase* sb),
@@ -176,7 +172,6 @@ out:
return(result);
}
//--------------------------------------------------------------------------//
/* This routine is called every time a Task or Process invokes
OpenLibrary() on this library. Task switching will be disabled
when control passes through this routine. Every action in this
@@ -192,7 +187,7 @@ out:
This routine must return the Library base pointer if it succeeds.
Failure is indicated by returning NULL instead. */
//--------------------------------------------------------------------------//
STATIC struct TimezoneBase * ASM
lib_open(REG(a6,APTR base))
{
@@ -237,7 +232,6 @@ out:
return(result);
}
//--------------------------------------------------------------------------//
/* This routine will be called when the library needs to be
removed from memory. If there are no Tasks or Processes
which have the library open, the routine must remove itself
@@ -247,7 +241,7 @@ out:
can be unloaded. This routine is the last to be called in
the life cycle of the library. It is called while Task
switching is disabled. */
//--------------------------------------------------------------------------//
STATIC BPTR ASM
lib_expunge(REG(a6,APTR base))
{
@@ -297,12 +291,11 @@ lib_expunge(REG(a6,APTR base))
return(result);
}
//--------------------------------------------------------------------------//
/* This routine is called every time CloseLibrary() is used
on the Library base data structure. It is called while
Task switching is disabled and has to return the result
code of the library expunge routine when the time is right. */
//--------------------------------------------------------------------------//
STATIC BPTR ASM
lib_close(REG(a6,APTR base))
{
@@ -330,7 +323,6 @@ lib_close(REG(a6,APTR base))
return(result);
}
//--------------------------------------------------------------------------//
#if defined(__amigaos4__)
STATIC ULONG
@@ -392,6 +384,12 @@ STATIC CONST APTR main_vectors[]=
asctime_r,
strftime,
strftime_l,
strptime,
strptime_l,
daylight_c,
timezone_c,
altzone_c,
tzname_c,
getsystime,
setsystime,
gettimeofday,
@@ -440,11 +438,10 @@ CONST struct TagItem local_lib_create_tags[] =
{ TAG_DONE, 0 }
};
//--------------------------------------------------------------------------//
/* This definition and how it is used makes sure that the library
version information will be visible even with an old 68k "Version"
command and not just with the OS4 "Version" command. */
//--------------------------------------------------------------------------//
STATIC CONST UBYTE version_string[] = "$VER: " VSTRING;
CONST struct Resident LibTag =
@@ -463,21 +460,19 @@ CONST struct Resident LibTag =
#else
//--------------------------------------------------------------------------//
/* This is the reserved library entry point. It always
has to return 0. */
//--------------------------------------------------------------------------//
STATIC LONG
lib_reserved(VOID)
{
return(0);
}
//--------------------------------------------------------------------------//
/* The following data structures and data are responsible for
setting up the Library base data structure and the library
function vector. */
//--------------------------------------------------------------------------//
struct LibraryInitTable
{
ULONG lit_BaseSize; /* Size of the base data structure. */
@@ -486,11 +481,10 @@ struct LibraryInitTable
APTR lit_InitRoutine; /* The address of the routine to do the setup. */
};
//--------------------------------------------------------------------------//
/* This is the table of functions that make up the library. The first
four are mandatory, everything following it are user callable
routines. The table is terminated by the value -1. */
//--------------------------------------------------------------------------//
STATIC CONST APTR lib_vectors[] =
{
lib_open,
@@ -516,6 +510,12 @@ STATIC CONST APTR lib_vectors[] =
asctime_r,
strftime,
strftime_l,
strptime,
strptime_l,
daylight_c,
timezone_c,
altzone_c,
tzname_c,
getsystime,
setsystime,
gettimeofday,
@@ -528,10 +528,9 @@ STATIC CONST APTR lib_vectors[] =
(APTR) -1
};
//--------------------------------------------------------------------------//
/* This finally sets up the library base data structure and the
function vector. */
//--------------------------------------------------------------------------//
STATIC CONST struct LibraryInitTable lib_init_table =
{
sizeof(struct TimezoneBase),
@@ -540,11 +539,10 @@ STATIC CONST struct LibraryInitTable lib_init_table =
lib_init
};
//--------------------------------------------------------------------------//
/* The library loader looks for this marker in the memory
the library code and data will occupy. It is responsible
setting up the Library base data structure. */
//--------------------------------------------------------------------------//
struct Resident LibTag =
{
RTC_MATCHWORD, /* Marker value. */
@@ -558,6 +556,5 @@ struct Resident LibTag =
VSTRING, /* The identification string of this Library. */
(APTR)&lib_init_table /* This table is for initializing the Library. */
};
//--------------------------------------------------------------------------//
#endif
+9 -10
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,21 +28,21 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
#ifndef _LIB_MACROS_H
#define _LIB_MACROS_H
//--------------------------------------------------------------------------//
#include <exec/types.h>
#include <dos/dos.h>
//--------------------------------------------------------------------------//
/* We use a few macros to ease the declaration of function parameters
which are normally part of the AmigaOS4 header files. They are
automatically included by the <exec/types.h> header file. However,
if you are going to build this code on the plain 68k AmigaOS
platform, you will need to define these macros locally. */
//--------------------------------------------------------------------------//
#ifndef AMIGA_COMPILER_H
//--------------------------------------------------------------------------//
#ifdef __SASC
# ifndef ASM
# define ASM __asm
@@ -53,7 +52,7 @@
# endif
# define APICALL
#endif
//--------------------------------------------------------------------------//
#ifdef __GNUC__
# ifndef ASM
# define ASM
@@ -64,11 +63,11 @@
# define APICALL
# define VARARGS68K
#endif
//--------------------------------------------------------------------------//
#endif /* AMIGA_COMPILER_H */
//--------------------------------------------------------------------------//
#ifndef ZERO
# define ZERO ((BPTR)NULL)
#endif
//--------------------------------------------------------------------------//
#endif
-194
View File
@@ -1,194 +0,0 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stddef.h>
#include <exec/io.h>
#include <exec/types.h>
#include <exec/memory.h>
#include <exec/semaphores.h>
#include <clib/exec_protos.h>
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "lib_mem.h"
//--------------------------------------------------------------------------//
struct MemoryBlock
{
struct MemoryBlock *next;
size_t size;
void *address;
};
//--------------------------------------------------------------------------//
struct MemoryList
{
struct MemoryBlock *first;
struct MemoryBlock *last;
long size;
long count;
};
//--------------------------------------------------------------------------//
struct MemoryList *list = NULL;
//--------------------------------------------------------------------------//
void allocerror(char*, size_t);
void deallocerror(char*, void*);
//--------------------------------------------------------------------------//
void* allocmem(size_t size)
{
struct MemoryBlock *newblock;
size_t allocsize;
if (list == NULL) {
list =
(struct MemoryList*)
AllocVec(sizeof(struct MemoryList), MEMF_ANY | MEMF_CLEAR);
if (!list) {
allocerror("list", sizeof(struct MemoryList));
return 0;
}
list->first = NULL;
list->last = NULL;
list->size = 0;
list->count = 0;
}
// Align to bytes of 4
allocsize = (size + 3) & ~0x03;
newblock =
(struct MemoryBlock*)
AllocVec(sizeof(struct MemoryBlock), MEMF_ANY | MEMF_CLEAR);
if (!newblock) {
allocerror("block", sizeof(struct MemoryBlock));
return 0;
}
newblock->address =
(struct MemoryBlock*)
AllocVec(allocsize, MEMF_ANY | MEMF_CLEAR);
if (!newblock->address) {
FreeVec(newblock);
allocerror("memory", allocsize);
return 0;
}
newblock->size = allocsize;
newblock->next = NULL;
if(list->first == NULL) {
list->first = newblock;
list->last = newblock;
} else {
list->last->next = newblock;
list->last = newblock;
}
list->size += allocsize;
list->count++;
// DEBUG code
// Debug(NULL, "Mememory allocated at address (%x)\n", newblock->address);
return newblock->address;
}
//--------------------------------------------------------------------------//
void freemem(void* block)
{
struct MemoryBlock *current, *last;
if (list == NULL || block == NULL) {
deallocerror("list", 0);
return;
}
if (block == NULL) {
deallocerror("memory", 0);
return;
}
last = NULL;
current = list->first;
while (current != NULL && current->address != block) {
last = current;
current = current->next;
}
if (current == NULL) {
deallocerror("address not found", block);
return;
}
list->size -= current->size;
list->count--;
if (list->first == current) {
list->first = NULL;
list->last = NULL;
} else if (list->last == current) {
last->next = current->next;
list->last = last;
} else {
last->next = current->next;
}
FreeVec(current->address);
FreeVec(current);
// DEBUG code
// Debug(NULL, "Mememory deallocated at address (%x)\n", block);
}
void freeall()
{
struct MemoryBlock *current, *next;
if (list == NULL) {
return;
}
current = list->first;
while (current != NULL) {
next = current->next;
FreeVec(current->address);
FreeVec(current);
current = next;
}
FreeVec(list);
list = NULL;
}
//--------------------------------------------------------------------------//
void allocerror(char *descr, size_t size)
{
//Debug("Mememory allocation error (%s) with size (%d)\n", descr, size);
}
void deallocerror(char *descr, void *p)
{
//Debug("Mememory deallocation error (%s) address (%x)\n", descr, p);
}
//--------------------------------------------------------------------------//
char *strdup(const char *s1)
{
char *s2;
size_t len = strlen(s1);
s2 = allocmem(++len);
if(s2 == NULL)
{
return NULL;
}
memcpy(s2, s1, --len);
return s2;
}
//--------------------------------------------------------------------------//
-16
View File
@@ -1,16 +0,0 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#ifndef AMIGA_MEM_H
#define AMIGA_MEM_H
//--------------------------------------------------------------------------//
#include <stddef.h>
//--------------------------------------------------------------------------//
void* allocmem(size_t);
void freemem(void*);
void freeall();
//--------------------------------------------------------------------------//
#define strdup(s) managed_strdup(s)
char *strdup(const char *s1);
//--------------------------------------------------------------------------//
#endif
+11 -32
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,21 +28,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "lib_mem.h"
#include "lib_user.h"
#include "time_state.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
#include "lib.h"
struct ExecBase* SysBase;
struct Library* DOSBase;
struct Library* UtilityBase;
struct Library* MathIeeeDoubBasBase;
struct Library* LocaleBase;
struct Device* TimerBase;
struct timerequest* TimeRequest;
//--------------------------------------------------------------------------//
/* The following function is called as part of the library initialization,
right after the library is loaded. This function should perform only
initialization operations which can be accomplished quickly and without
@@ -54,7 +48,7 @@ struct timerequest* TimeRequest;
By the time this function is invoked the library base has already been
initialized. It has to return TRUE for success and FALSE otherwise. */
//--------------------------------------------------------------------------//
bool UserLibInit(
struct Library* sysbase,
struct TimezoneBase* sb,
@@ -90,8 +84,6 @@ bool UserLibInit(
MathIeeeDoubBasBase = NULL;
UtilityBase = NULL;
LocaleBase = NULL;
TimerBase = NULL;
TimeRequest = NULL;
DOSBase = OpenLibrary(DOSLIB_NAME, LIB_VERSION);
if (!DOSBase) {
@@ -106,10 +98,6 @@ bool UserLibInit(
UtilityBase = OpenLibrary(UTILLIB_NAME, LIB_VERSION);
if (!UtilityBase) {
result = false;
} else {
if(!OpenTimer()) {
result = false;
}
}
LocaleBase = OpenLibrary(LOCALELIB_NAME, LIB_VERSION);
@@ -128,7 +116,6 @@ bool UserLibInit(
return result;
}
//--------------------------------------------------------------------------//
/* The following function is called whenever the library is opened. Since
by the time is called the library may have had another opener, it cannot
rely upon the sb->sb_Library.lib_OpenCnt value to be current, it must
@@ -139,7 +126,7 @@ bool UserLibInit(
schedule of the caller. Take care: some callers may be plain Tasks which
cannot call all dos.library functions! This function has to return TRUE for
success and FALSE otherwise. */
//--------------------------------------------------------------------------//
bool UserLibOpen(struct UserData * ud)
{
/* For the thread safe build, invoke the clib2 shared library
@@ -169,11 +156,10 @@ bool UserLibOpen(struct UserData * ud)
return true;
}
//--------------------------------------------------------------------------//
/* The following function is called whenever the library is closed. Its
purpose is to release any resources allocated by the UserLibOpen()
function, such as when the last caller has closed the library. */
//--------------------------------------------------------------------------//
void UserLibClose(struct UserData * ud)
{
/* Remember that one less customer is using this data structure. */
@@ -199,31 +185,26 @@ void UserLibClose(struct UserData * ud)
#endif /* __THREAD_SAFE */
}
//--------------------------------------------------------------------------//
/* The following function is called shortly before the library is to be
unloaded from memory. Its purpose is to release any resources
allocated by the UserLibInit() function. Note that this function must
not break the Forbid() condition, i.e. it must not call Wait() directly
or indirectly. */
//--------------------------------------------------------------------------//
void UserLibExpunge(struct UserData * ud)
{
if(lclptr) {
freemem(lclptr);
FreeMem(lclptr, sizeof(struct state));
}
if(gmtptr) {
freemem(gmtptr);
FreeMem(gmtptr, sizeof(struct state));
}
if (LocaleBase) {
CloseLibrary(LocaleBase);
}
if (TimerBase) {
CloseTimer();
}
if (UtilityBase) {
CloseLibrary(UtilityBase);
}
@@ -235,6 +216,4 @@ void UserLibExpunge(struct UserData * ud)
if (DOSBase) {
CloseLibrary(DOSBase);
}
freeall();
}
+1 -3
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,7 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
#include "compiler.h"
void *memmove(void *, const void *, size_t);
@@ -38,4 +37,3 @@ void bcopy(const void *src,void *dest,size_t len)
{
memmove(dest, src, len);
}
//--------------------------------------------------------------------------//
+1 -2
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,7 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
#include "compiler.h"
#if (defined(__GNUC__) && defined(__mc68020__) && defined(NDEBUG) && defined(undefined))
+1 -2
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,7 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
#include "compiler.h"
#if (defined(__GNUC__) && defined(__mc68020__) && defined(NDEBUG) && defined(undefined))
-4
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,7 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
char *strcat(char *dest, const char *src)
{
@@ -42,5 +40,3 @@ char *strcat(char *dest, const char *src)
return(result);
}
//--------------------------------------------------------------------------//
+1 -3
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,7 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
#include "compiler.h"
char *strchr(const char *s, int c)
@@ -56,4 +55,3 @@ char *strchr(const char *s, int c)
return(result);
}
//--------------------------------------------------------------------------//
-4
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,7 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
int strcmp(const char *s1, const char * s2)
{
@@ -58,5 +56,3 @@ int strcmp(const char *s1, const char * s2)
return(result);
}
//--------------------------------------------------------------------------//
-4
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,7 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
char *strcpy(char *dest, const char *src)
{
@@ -42,5 +40,3 @@ char *strcpy(char *dest, const char *src)
return(result);
}
//--------------------------------------------------------------------------//
+1 -4
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,7 +28,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
#include <stddef.h>
size_t strlen(const char *string)
@@ -45,5 +44,3 @@ size_t strlen(const char *string)
return result;
}
//--------------------------------------------------------------------------//
+37 -29
View File
@@ -1,4 +1,3 @@
//--------------------------------------------------------------------------//
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
@@ -29,33 +28,42 @@
* POSSIBILITY OF SUCH DAMAGE.
*
*/
//--------------------------------------------------------------------------//
#ifndef _LIB_TIME_USER_H
#define _LIB_TIME_USER_H
//--------------------------------------------------------------------------//
#include <exec/execbase.h>
#include <exec/libraries.h>
#include "compiler.h"
#include "lib_macros.h"
//--------------------------------------------------------------------------//
struct TimezoneBase;
struct UserData
#include "compiler.h"
int strncmp(const char *s1, const char *s2, size_t n)
{
struct Library* ud_SysBase;
#if defined(__amigaos4__)
struct ExecIFace* ud_IExec;
#endif
struct TimezoneBase* ud_ZoneinfoBase;
ULONG ud_UseCount;
};
//--------------------------------------------------------------------------//
bool UserLibInit(
struct Library *SysBase,
struct TimezoneBase *sb,
struct UserData *ud);
bool UserLibOpen(struct UserData *ud);
void UserLibClose(struct UserData *ud);
void UserLibExpunge(struct UserData *ud);
//--------------------------------------------------------------------------//
#endif
int result = 0;
/* If the number of characters is 0 or negative, then this
* function is supposed to have no effect.
*/
if(s1 != s2 && (int)n > 0)
{
while(n-- > 0)
{
if((*s1) == (*s2))
{
if((*s1) == '\0')
break;
s1++;
s2++;
}
else
{
int c1,c2;
/* The comparison must be performed as if the
characters were unsigned characters. */
c1 = *(unsigned char *)s1;
c2 = *(unsigned char *)s2;
result = c1 - c2;
break;
}
}
}
return(result);
}
-54
View File
@@ -1,54 +0,0 @@
//--------------------------------------------------------------------------//
/*
* 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.
*
*/
//--------------------------------------------------------------------------//
#include "lib_macros.h"
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++;
}
}
//--------------------------------------------------------------------------//
+63
View File
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2015 Carsten Larsen
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
* 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.
* 3. Neither the name of Olaf Barthel nor the names of 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 COPYRIGHT OWNER 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.
*
*/
#include "compiler.h"
#include "time_header.h"
int strncasecmp(const char * _s1, const char * _s2, size_t n)
{
const unsigned char *s1 = (const unsigned char *)_s1;
const unsigned char *s2 = (const unsigned char *)_s2;
unsigned char c1,c2;
int result = 0;
if(s1 != s2)
{
while(n-- > 0)
{
c1 = toupper(*s1++);
c2 = toupper(*s2++);
if(c1 == c2)
{
if(c1 == '\0')
break;
}
else
{
result = (int)c1 - (int)c2;
break;
}
}
}
return(result);
}
+9 -14
View File
@@ -2,14 +2,10 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "time_tm.h"
#include "lib_macros.h"
#include "time_proto.h"
#include "time_types.h"
#include "time_tzfile.h"
#define STD_ASCTIME_BUF_SIZE 40
#include "time_header.h"
#define STD_ASCTIME_BUF_SIZE 26
#define MAX_ASCTIME_BUF_SIZE 64
static char buf_asctime[MAX_ASCTIME_BUF_SIZE];
@@ -22,8 +18,7 @@ struct out {
int16_t hour;
int16_t min;
int16_t sec;
const char* zone;
int16_t year;
const char* year;
APTR end;
};
@@ -41,8 +36,8 @@ char* ASM asctime_r(
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
static const char *fmt1 = "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %s %d\n";
static const char *fmt2 = "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %s %d\n"; // TODO
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";
struct out out;
char year[6];
@@ -63,12 +58,13 @@ char* ASM asctime_r(
else
out.mn = mon_name[timeptr->tm_mon];
strftime(year, 6, "%Y", timeptr);
out.day = timeptr->tm_mday;
out.hour = timeptr->tm_hour;
out.min = timeptr->tm_min;
out.sec = timeptr->tm_sec;
out.zone = timeptr->tm_zone;
out.year = timeptr->tm_year + TM_YEAR_BASE;
out.year = year;
out.end = NULL;
RawDoFmt(
@@ -89,4 +85,3 @@ char* ASM asctime(
{
return asctime_r(timeptr, buf_asctime);
}
//--------------------------------------------------------------------------//
+14 -17
View File
@@ -2,19 +2,18 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_tm.h"
#include "compiler.h"
#include "lib_macros.h"
#include "time_types.h"
#include "time_state.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
/*
* Section 4.12.3.2 of X3.159-1989 requires that
* The ctime function converts the calendar time pointed to by timer
* to local time in the form of a string. It is equivalent to
* asctime(localtime(timer))
*/
#include "time_header.h"
static struct tm tm;
/**
* Section 4.12.3.2 of X3.159-1989 requires that
* The ctime function converts the calendar time pointed to by timer
* to local time in the form of a string. It is equivalent to
* asctime(localtime(timer))
*
*/
char* ASM ctime(
REG(a0, const time_t *const timep)
)
@@ -28,8 +27,6 @@ char* ASM ctime_r(
REG(a1, char *buf)
)
{
struct tm mytm;
struct tm *tmp = localtime_r(timep, &mytm);
return tmp ? asctime_r(tmp, buf) : NULL;
struct tm *tmp = localtime_r(timep, &tm);
return tmp ? asctime_r(&tm, buf) : NULL;
}
//--------------------------------------------------------------------------//
+4 -8
View File
@@ -2,14 +2,12 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_tm.h"
#include "lib_macros.h"
#include "time_types.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
double ASM difftime(
REG(d0, const time_t time1),
REG(d1, const time_t time0)
REG(d1, const time_t time1),
REG(d0, const time_t time0)
)
{
/*
@@ -54,5 +52,3 @@ double ASM difftime(
return -(double) ((uintmax_t) time0 + (uintmax_t) (-1 - time1) + 1);
}
//--------------------------------------------------------------------------//
+4 -7
View File
@@ -2,10 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "lib_mem.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
void gmtcheck(void)
{
@@ -17,7 +15,8 @@ void gmtcheck(void)
if (!gmt_is_set) {
gmtptr = (struct state*)allocmem(sizeof(struct state));
gmtptr = (struct state*)
AllocMem(sizeof(struct state), MEMF_PUBLIC | MEMF_CLEAR);
if (gmtptr) {
gmtload(gmtptr);
@@ -28,5 +27,3 @@ void gmtcheck(void)
unlock();
}
//--------------------------------------------------------------------------//
+2 -6
View File
@@ -2,10 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_tm.h"
#include "lib_macros.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
static struct tm tm;
@@ -24,5 +22,3 @@ struct tm* ASM gmtime_r(
gmtcheck();
return gmtsub(gmtptr, timep, 0, tmp);
}
//--------------------------------------------------------------------------//
+2 -5
View File
@@ -2,9 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_state.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
void gmtload(struct state *const sp)
{
@@ -12,5 +11,3 @@ void gmtload(struct state *const sp)
tzparse(gmt, sp, true);
}
}
//--------------------------------------------------------------------------//
+2 -6
View File
@@ -2,16 +2,14 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_types.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
/**
*
* gmtsub is to gmtime as localsub is to localtime.
*
*/
struct tm *gmtsub(
struct state const *sp,
time_t const *timep,
@@ -30,5 +28,3 @@ struct tm *gmtsub(
return result;
}
//--------------------------------------------------------------------------//
+70 -42
View File
@@ -1,16 +1,18 @@
//--------------------------------------------------------------------------//
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#ifndef _TIME_PROTOS_H
#define _TIME_PROTOS_H
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#ifndef _TIME_HEADER_H
#define _TIME_HEADER_H
#include "compiler.h"
#include "lib_macros.h"
#include "time_tm.h"
#include "time_types.h"
#include "time_state.h"
//--------------------------------------------------------------------------//
#include "time_length.h"
#include "time_tzfile.h"
void ASM tzset(void);
timezone_t ASM tzalloc(
@@ -20,7 +22,7 @@ timezone_t ASM tzalloc(
void ASM tzfree(
REG(a0,timezone_t tz)
);
//--------------------------------------------------------------------------//
time_t ASM time(
REG(a0, time_t *tloc)
);
@@ -33,7 +35,7 @@ time_t ASM mktime_z(
REG(a1, const timezone_t tz),
REG(a0, struct tm *)
);
//--------------------------------------------------------------------------//
struct tm* ASM localtime(
REG(a0, const time_t *const timep)
);
@@ -48,7 +50,7 @@ struct tm* ASM localtime_rz(
REG(a0, time_t const *timep),
REG(a1, struct tm *tmp)
);
//--------------------------------------------------------------------------//
struct tm* ASM gmtime(
REG(a0, const time_t *timep)
);
@@ -57,7 +59,7 @@ struct tm* ASM gmtime_r(
REG(a0, const time_t *timep),
REG(a1, struct tm *tmp)
);
//--------------------------------------------------------------------------//
char* ASM ctime(
REG(a0, const time_t *const timep)
);
@@ -66,12 +68,12 @@ char* ASM ctime_r(
REG(a0, const time_t *const timep),
REG(a1, char *buf)
);
//--------------------------------------------------------------------------//
double ASM difftime(
REG(d1, const time_t time1),
REG(d0, const time_t time0)
);
//--------------------------------------------------------------------------//
char* ASM asctime(
REG(a0, const struct tm *timeptr)
);
@@ -80,7 +82,7 @@ char* ASM asctime_r(
REG(a0,const struct tm *timeptr),
REG(a1,char *buf)
);
//--------------------------------------------------------------------------//
size_t ASM strftime(
REG(a0, char * const s),
REG(d0, size_t maxsize),
@@ -95,12 +97,30 @@ size_t ASM strftime_l(
REG(a2, const struct tm *const t),
REG(a3, locale_t locale)
);
//--------------------------------------------------------------------------//
void ASM getsystime(
char* ASM strptime(
REG(a0, const char *buf),
REG(a1, const char *fmt),
REG(a2, struct tm *tm)
);
char* ASM strptime_l(
REG(a0, const char *buf),
REG(a1, const char *fmt),
REG(a2, struct tm *tm),
REG(a3, locale_t locale)
);
int ASM daylight_c(void);
long ASM timezone_c(void);
long ASM altzone_c(void);
char** ASM tzname_c(void);
int ASM getsystime(
REG(a0, struct timeval *tv)
);
void ASM setsystime(
int ASM setsystime(
REG(a0, struct timeval *tv)
);
@@ -113,7 +133,7 @@ int ASM settimeofday(
REG(a0, const struct timeval *tv),
REG(a1, const timezone_t tz)
);
//--------------------------------------------------------------------------//
int ASM gmtoffset(
REG(d0, time_t locale_time)
);
@@ -127,22 +147,23 @@ void ASM underscore_add(
void ASM underscore_remove(
REG(a0, char *s)
);
//--------------------------------------------------------------------------//
// Internal time zone database library functions //
//--------------------------------------------------------------------------//
// Internal time zone database library functions
struct ttinfo;
int lock(void);
void unlock(void);
//--------------------------------------------------------------------------//
int tzload(char const *name, struct state *sp, bool doextend);
bool tzparse(const char *name, struct state *const sp, bool lastditch);
//--------------------------------------------------------------------------//
int zoneinit(struct state *sp, char const *name);
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 gmtcheck(void);
void gmtload(struct state *const sp);
struct tm* gmtsub(
@@ -152,16 +173,16 @@ struct tm* gmtsub(
struct tm *tmp
);
struct tm *localtime_tzset(time_t const *timep, struct tm *tmp, bool setname);
//--------------------------------------------------------------------------//
struct tm* timesub(
const time_t *const timep,
const int_fast32_t offset,
const struct state *const sp,
struct tm *const tmp
);
//--------------------------------------------------------------------------//
time_t mktime_tzname(struct state *sp, struct tm *tmp, bool setname);
//--------------------------------------------------------------------------//
bool increment_overflow(int *const ip, int j);
bool increment_overflow_time(time_t *tp, int_fast32_t j);
struct tm * localsub(
@@ -170,25 +191,32 @@ struct tm * localsub(
int_fast32_t setname,
struct tm* const tmp
);
//--------------------------------------------------------------------------//
// Stadard C library functions //
//--------------------------------------------------------------------------//
void bcopy(const void *src, void *dest, size_t len); // <string.h> //
void *memmove(void *dest, const void * src, size_t len); // <string.h> //
size_t strlen(const char *string); // <string.h> //
char *strcpy(char *dest, const char *src); // <string.h> //
char *strcat(char *dest, const char *src); // <string.h> //
int strcmp(const char *s1, const char * s2); // <string.h> //
char *strchr(const char *s, int c); // <string.h> //
char *getenv(const char * name); // <stdlib.h> //
//--------------------------------------------------------------------------//
bool CreateTimer();
void DeleteTimer();
extern struct Device* TimerBase;
extern struct timerequest* TimeRequest;
// Stadard C library functions
void bcopy(const void *src, void *dest, size_t len); // <string.h>
void *memmove(void *dest, const void * src, size_t len); // <string.h>
size_t strlen(const char *string); // <string.h>
char *strcpy(char *dest, const char *src); // <string.h>
char *strcat(char *dest, const char *src); // <string.h>
int strcmp(const char *s1, const char * s2); // <string.h>
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 strncasecmp(const char * _s1, const char * _s2, size_t n);
#if defined(__GNUC__) && (__GNUC__ < 3)
void *memcpy(void *dst, const void *src, unsigned long len);
#else
void *memcpy(void *dst, const void *src, size_t len);
#endif
//--------------------------------------------------------------------------//
bool OpenTimer();
bool CloseTimer();
//--------------------------------------------------------------------------//
#endif
+2 -5
View File
@@ -2,9 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "time_types.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
bool increment_overflow(int *const ip, int j)
{
@@ -39,5 +38,3 @@ bool increment_overflow_time(time_t *tp, int_fast32_t j)
*tp += j;
return false;
}
//--------------------------------------------------------------------------//
+6 -6
View File
@@ -2,11 +2,13 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_types.h"
#include "time_state.h"
//--------------------------------------------------------------------------//
/* Initialize *S to a value based on GMTOFF, ISDST, and ABBRIND. */
#include "time_header.h"
/**
* Initialize *S to a value based on GMTOFF, ISDST, and ABBRIND.
*
*/
void init_ttinfo(struct ttinfo *s, int_fast32_t gmtoff, bool isdst, int abbrind)
{
s->tt_gmtoff = gmtoff;
@@ -15,5 +17,3 @@ void init_ttinfo(struct ttinfo *s, int_fast32_t gmtoff, bool isdst, int abbrind)
s->tt_ttisstd = false;
s->tt_ttisgmt = false;
}
//--------------------------------------------------------------------------//
+1 -3
View File
@@ -2,8 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_length.h"
//--------------------------------------------------------------------------//
const int mon_lengths[2][MONSPERYEAR] = {
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
@@ -13,5 +13,3 @@ const int mon_lengths[2][MONSPERYEAR] = {
const int year_lengths[2] = {
DAYSPERNYEAR, DAYSPERLYEAR
};
//--------------------------------------------------------------------------//
+13 -12
View File
@@ -2,14 +2,15 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#ifndef _TIME_LENGTH_H
#define _TIME_LENGTH_H
//--------------------------------------------------------------------------//
// Maximum number of leap second corrections
#ifndef TZ_MAX_LEAPS
# define TZ_MAX_LEAPS 50
#endif
//--------------------------------------------------------------------------//
#define SECSPERMIN 60
#define MINSPERHOUR 60
#define HOURSPERDAY 24
@@ -19,7 +20,7 @@
#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
#define SECSPERDAY ((int_fast32_t) SECSPERHOUR * HOURSPERDAY)
#define MONSPERYEAR 12
//--------------------------------------------------------------------------//
#define TM_SUNDAY 0
#define TM_MONDAY 1
#define TM_TUESDAY 2
@@ -27,7 +28,7 @@
#define TM_THURSDAY 4
#define TM_FRIDAY 5
#define TM_SATURDAY 6
//--------------------------------------------------------------------------//
#define TM_JANUARY 0
#define TM_FEBRUARY 1
#define TM_MARCH 2
@@ -40,19 +41,19 @@
#define TM_OCTOBER 9
#define TM_NOVEMBER 10
#define TM_DECEMBER 11
//--------------------------------------------------------------------------//
#define TM_YEAR_BASE 1900
//--------------------------------------------------------------------------//
#define EPOCH_YEAR 1970
#define EPOCH_WDAY TM_THURSDAY
//--------------------------------------------------------------------------//
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
//--------------------------------------------------------------------------//
// years before a Gregorian repeat
#ifndef YEARSPERREPEAT
# define YEARSPERREPEAT 400
#endif
//--------------------------------------------------------------------------//
// The Gregorian year averages 365.2425 days, which is 31556952 seconds.
#ifndef AVGSECSPERYEAR
# define AVGSECSPERYEAR 31556952L
@@ -63,12 +64,12 @@
#ifndef SECSPERREPEAT_BITS
# define SECSPERREPEAT_BITS 34 // ceil(log2(SECSPERREPEAT))
#endif
//--------------------------------------------------------------------------//
#define JULIAN_DAY 0 // Jn = Julian day
#define DAY_OF_YEAR 1 // n = day of year
#define MONTH_NTH_DAY_OF_WEEK 2 // Mm.n.d = month, week, day of week
//--------------------------------------------------------------------------//
extern const int mon_lengths[2][MONSPERYEAR];
extern const int year_lengths[2];
//--------------------------------------------------------------------------//
#endif
+121
View File
@@ -0,0 +1,121 @@
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#include "time_local.h"
#include "time_header.h"
const struct lc_time_T C_time_locale = {
{
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
}, {
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
}, {
"Sun", "Mon", "Tue", "Wed",
"Thu", "Fri", "Sat"
}, {
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
},
/* X_fmt */
"%H:%M:%S",
/*
** x_fmt
** C99 requires this format.
** Using just numbers (as here) makes Quakers happier;
** it's also compatible with SVR4.
*/
"%m/%d/%y",
/*
** c_fmt
** C99 requires this format.
** Previously this code used "%D %X", but we now conform to C99.
** Note that
** "%a %b %d %H:%M:%S %Y"
** is used by Solaris 2.3.
*/
"%a %b %e %T %Y",
/* am */
"AM",
/* pm */
"PM",
/* date_fmt */
"%a %b %e %H:%M:%S %Z %Y"
};
struct lc_time_T* openlc(locale_t locale)
{
int i, j;
struct lc_time_T *l = (struct lc_time_T*)AllocMem(
sizeof(struct lc_time_T),
MEMF_ANY | MEMF_CLEAR
);
struct Locale *loc = locale;
if (!loc) {
loc = OpenLocale(NULL);
}
l->X_fmt = loc->loc_TimeFormat;
l->x_fmt = loc->loc_ShortDateFormat;
l->c_fmt = loc->loc_DateTimeFormat;
l->am = GetLocaleStr(loc, AM_STR);
l->pm = GetLocaleStr(loc, PM_STR);
l->date_fmt = "%a %b %e %H:%M:%S %Z %Y";
j = 0;
for(i = 1; i < 8; i++) {
l->weekday[j++] = GetLocaleStr(loc, i);
}
j = 0;
for(i = 8; i < 15; i++) {
l->wday[j++] = GetLocaleStr(loc, i);
}
j = 0;
for(i = 15; i < 27; i++) {
l->month[j++] = GetLocaleStr(loc, i);
}
j = 0;
for(i = 27; i < 39; i++) {
l->mon[j++] = GetLocaleStr(loc, i);
}
l->locale = loc;
return l;
}
void closelc(struct lc_time_T *lc)
{
if (lc->locale) {
CloseLocale(lc->locale);
}
FreeMem(lc, sizeof(struct lc_time_T));
}
+43
View File
@@ -0,0 +1,43 @@
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef _TIME_LOCAL_H
#define _TIME_LOCAL_H
#include "time_header.h"
struct lc_time_T {
const char* mon[MONSPERYEAR];
const char* month[MONSPERYEAR];
const char* wday[DAYSPERWEEK];
const char* weekday[DAYSPERWEEK];
const char* X_fmt;
const char* x_fmt;
const char* c_fmt;
const char* am;
const char* pm;
const char* date_fmt;
locale_t locale;
};
extern const struct lc_time_T C_time_locale;
struct lc_time_T* openlc(locale_t locale);
void closelc(struct lc_time_T *lc);
#endif
+3 -7
View File
@@ -2,10 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_tm.h"
#include "time_proto.h"
#include "time_length.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
struct tm * localsub(
struct state const *sp,
@@ -79,7 +77,7 @@ struct tm * localsub(
int hi = sp->timecnt;
while (lo < hi) {
int mid = (lo + hi) >> 1;
int mid = (lo + hi) >> 1;
if (t < sp->ats[mid]) {
hi = mid;
@@ -112,5 +110,3 @@ struct tm * localsub(
return result;
}
//--------------------------------------------------------------------------//
+2 -7
View File
@@ -2,12 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_tm.h"
#include "lib_macros.h"
#include "time_types.h"
#include "time_state.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
static struct tm tm;
@@ -32,4 +28,3 @@ struct tm* ASM localtime_rz(
return localsub(tz, timep, 0, tmp);
}
//--------------------------------------------------------------------------//
+2 -8
View File
@@ -2,12 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_tm.h"
#include "compiler.h"
#include "time_types.h"
#include "time_state.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
struct tm *localtime_tzset(time_t const *timep, struct tm *tmp, bool setname)
{
@@ -27,5 +23,3 @@ struct tm *localtime_tzset(time_t const *timep, struct tm *tmp, bool setname)
return tmp;
}
//--------------------------------------------------------------------------//
+2 -4
View File
@@ -2,8 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "compiler.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
struct SignalSemaphore TimeSemaphore;
@@ -17,5 +17,3 @@ void unlock(void)
{
ReleaseSemaphore(&TimeSemaphore);
}
//--------------------------------------------------------------------------//
+2 -6
View File
@@ -2,10 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_tm.h"
#include "lib_macros.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
time_t ASM mktime(
REG(a0, struct tm *tmp)
@@ -34,5 +32,3 @@ time_t ASM mktime_z(
{
return mktime_tzname(sp, tmp, false);
}
//--------------------------------------------------------------------------//
+2 -7
View File
@@ -2,11 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_tm.h"
#include "time_proto.h"
#include "time_types.h"
#include "time_length.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
#ifndef WRONG
# define WRONG (-1)
@@ -402,5 +399,3 @@ time_t mktime_tzname(struct state *sp, struct tm *tmp, bool setname)
return time1(tmp, gmtsub, gmtptr, 0);
}
}
//--------------------------------------------------------------------------//
+7 -7
View File
@@ -2,11 +2,12 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#ifndef _TIME_RULES_H
#define _TIME_RULES_H
//--------------------------------------------------------------------------//
#ifndef _TIME_RULE_H
#define _TIME_RULE_H
#include "time_types.h"
//--------------------------------------------------------------------------//
/*
* The DST rules to use if TZ has no rules and we can't load TZDEFRULES.
* We default to US rules as of 1999-08-17.
@@ -17,7 +18,7 @@
#ifndef TZDEFRULESTRING
# define TZDEFRULESTRING ",M4.1.0,M10.5.0"
#endif
//--------------------------------------------------------------------------//
struct rule {
int r_type; /* type of rule; see below */
int r_day; /* day number of rule */
@@ -25,6 +26,5 @@ struct rule {
int r_mon; /* month number of rule */
int_fast32_t r_time; /* transition time of rule */
};
//--------------------------------------------------------------------------//
#endif
#endif
+2 -6
View File
@@ -2,10 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_types.h"
#include "time_state.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
void settzname(void)
{
@@ -39,5 +37,3 @@ void settzname(void)
daylight = 1;
}
}
//--------------------------------------------------------------------------//
+25 -11
View File
@@ -2,30 +2,44 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "time_state.h"
#include "time_types.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
const char gmt[GMT_CHAR_SIZE] = "GMT";
const char wildabbr[WILDABBR_SIZE] = WILDABBR;
//--------------------------------------------------------------------------//
char* tzname[2] = {
(char *) wildabbr,
(char *) wildabbr
};
//--------------------------------------------------------------------------//
char lcl_TZname[TZ_STRLEN_MAX + 1];
int lcl_is_set;
//--------------------------------------------------------------------------//
struct state *lclptr;
struct state *gmtptr;
//--------------------------------------------------------------------------//
long timezone;
long altzone;
int daylight;
//--------------------------------------------------------------------------//
int errno;
//--------------------------------------------------------------------------//
time_t const time_t_min = MINVAL(time_t, TYPE_BIT(time_t));
time_t const time_t_max = MAXVAL(time_t, TYPE_BIT(time_t));
//--------------------------------------------------------------------------//
int ASM daylight_c(void) {
return daylight;
}
long ASM timezone_c(void) {
return timezone;
}
long ASM altzone_c(void) {
return altzone;
}
char** ASM tzname_c(void) {
return (char**)tzname;
}
+14 -14
View File
@@ -2,16 +2,16 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#ifndef _TIME_STATE_H
#define _TIME_STATE_H
//--------------------------------------------------------------------------//
#include "time_header.h"
#include "time_tzfile.h"
#include "compiler.h"
#include "time_types.h"
//--------------------------------------------------------------------------//
#define GMT_CHAR_SIZE 3
#define TZ_STRLEN_MAX 255
//--------------------------------------------------------------------------//
#ifndef WILDABBR
/*
* Someone might make incorrect use of a time zone abbreviation:
@@ -35,24 +35,24 @@
#define WILDABBR " "
#define WILDABBR_SIZE 3
#endif
//--------------------------------------------------------------------------//
extern const char wildabbr[WILDABBR_SIZE];
extern const char gmt[GMT_CHAR_SIZE];
//--------------------------------------------------------------------------//
extern char* tzname[2];
extern char lcl_TZname[TZ_STRLEN_MAX + 1];
extern int lcl_is_set;
//--------------------------------------------------------------------------//
#define SMALLEST(a, b) (((a) < (b)) ? (a) : (b))
#define BIGGEST(a, b) (((a) > (b)) ? (a) : (b))
//--------------------------------------------------------------------------//
#ifdef TZNAME_MAX
# define MY_TZNAME_MAX TZNAME_MAX
#endif
#ifndef TZNAME_MAX
# define MY_TZNAME_MAX 255
#endif
//--------------------------------------------------------------------------//
struct ttinfo { /* time type information */
int_fast32_t tt_gmtoff; /* UT offset in seconds */
bool tt_isdst; /* used to set tm_isdst */
@@ -81,14 +81,14 @@ struct state {
struct lsinfo lsis[TZ_MAX_LEAPS];
int defaulttype; /* for early times or if no transitions */
};
//--------------------------------------------------------------------------//
extern struct state *lclptr;
extern struct state *gmtptr;
//--------------------------------------------------------------------------//
extern long timezone;
extern int daylight;
extern long altzone;
//--------------------------------------------------------------------------//
extern int errno;
//--------------------------------------------------------------------------//
#endif
+4 -154
View File
@@ -1,36 +1,3 @@
//--------------------------------------------------------------------------//
/*
* 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.
*
* Forked from Time Zone Data v. 2015e (Released 2015-06-13):
* https://www.iana.org/time-zones/repository/releases/tzdata2015e.tar.gz
*
* Based on the UCB version with the copyright notice and sccsid
* appearing below.
*
*/
//--------------------------------------------------------------------------//
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
@@ -48,76 +15,9 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*/
//--------------------------------------------------------------------------//
#include "time_tm.h"
#include "time_tzfile.h"
#include "compiler.h"
#include "lib_mem.h"
#include "lib_macros.h"
#include "time_proto.h"
#include "time_types.h"
//--------------------------------------------------------------------------//
struct lc_time_T {
const char* mon[MONSPERYEAR];
const char* month[MONSPERYEAR];
const char* wday[DAYSPERWEEK];
const char* weekday[DAYSPERWEEK];
const char* X_fmt;
const char* x_fmt;
const char* c_fmt;
const char* am;
const char* pm;
const char* date_fmt;
};
static const struct lc_time_T C_time_locale = {
{
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
}, {
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
}, {
"Sun", "Mon", "Tue", "Wed",
"Thu", "Fri", "Sat"
}, {
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
},
/* X_fmt */
"%H:%M:%S",
/*
** x_fmt
** C99 requires this format.
** Using just numbers (as here) makes Quakers happier;
** it's also compatible with SVR4.
*/
"%m/%d/%y",
/*
** c_fmt
** C99 requires this format.
** Previously this code used "%D %X", but we now conform to C99.
** Note that
** "%a %b %d %H:%M:%S %Y"
** is used by Solaris 2.3.
*/
"%a %b %e %T %Y",
/* am */
"AM",
/* pm */
"PM",
/* date_fmt */
"%a %b %e %H:%M:%S %Z %Y"
};
//--------------------------------------------------------------------------//
#include "time_header.h"
#include "time_local.h"
static size_t _strftime(
char * const s,
@@ -140,8 +40,6 @@ extern char* tzname[];
static const unsigned long _callback[] = { 0x16c04e75 };
//--------------------------------------------------------------------------//
size_t ASM strftime(
REG(a0, char * const s),
REG(d0, size_t maxsize),
@@ -152,8 +50,6 @@ size_t ASM strftime(
return _strftime(s, maxsize, format, t, (struct lc_time_T*)&C_time_locale);
}
//--------------------------------------------------------------------------//
size_t ASM strftime_l(
REG(a0, char *s),
REG(d0, size_t maxsize),
@@ -162,55 +58,15 @@ size_t ASM strftime_l(
REG(a3, locale_t locale)
)
{
int i, j;
size_t res;
struct lc_time_T* l = (struct lc_time_T*)allocmem(sizeof(struct lc_time_T));
struct Locale *loc = locale;
if (!loc) {
loc = OpenLocale(NULL);
}
l->X_fmt = loc->loc_TimeFormat;
l->x_fmt = loc->loc_ShortDateFormat;
l->c_fmt = loc->loc_DateTimeFormat;
l->am = GetLocaleStr(loc, AM_STR);
l->pm = GetLocaleStr(loc, PM_STR);
l->date_fmt = "%a %b %e %H:%M:%S %Z %Y";
j = 0;
for(i = 1; i < 8; i++) {
l->weekday[j++] = GetLocaleStr(loc, i);
}
j = 0;
for(i = 8; i < 15; i++) {
l->wday[j++] = GetLocaleStr(loc, i);
}
j = 0;
for(i = 15; i < 27; i++) {
l->month[j++] = GetLocaleStr(loc, i);
}
j = 0;
for(i = 27; i < 39; i++) {
l->mon[j++] = GetLocaleStr(loc, i);
}
struct lc_time_T* l = openlc(locale);
res = _strftime(s, maxsize, format, t, l);
if (locale) {
CloseLocale(loc);
}
freemem(l);
closelc(l);
return res;
}
//--------------------------------------------------------------------------//
static size_t _strftime(
char * const s,
const size_t maxsize,
@@ -623,8 +479,6 @@ label:
return pt;
}
//--------------------------------------------------------------------------//
struct param {
int16_t val;
char* end;
@@ -650,8 +504,6 @@ static char* _conv(
return _add(buf, pt, ptlim);
}
//--------------------------------------------------------------------------//
static char* _add(
const char *str,
char *pt,
@@ -665,7 +517,6 @@ static char* _add(
return pt;
}
//--------------------------------------------------------------------------//
/**
*
* POSIX and the C Standard are unclear or inconsistent about
@@ -707,4 +558,3 @@ static char* _yconv(
pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim);
return pt;
}
//--------------------------------------------------------------------------//
+684
View File
@@ -0,0 +1,684 @@
/*-
* Copyright (c) 1997, 1998, 2005, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code was contributed to The NetBSD Foundation by Klaus Klein.
* Heavily optimised by David Laight
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*
* $NetBSD: strptime.c,v 1.47 2015/07/22 13:33:59 ginsbach Exp $
*
*/
#include "time_header.h"
#include "time_local.h"
static const u_char *conv_num(const unsigned char *, int *, uint, uint);
static const u_char *find_string(const u_char *, int *, const char * const *,
const char * const *, int);
/*
* We do not implement alternate representations. However, we always
* check whether a given modifier is allowed for a certain conversion.
*/
#define ALT_E 0x01
#define ALT_O 0x02
#define LEGAL_ALT(x) { if (alt_format & ~(x)) return NULL; }
#define S_YEAR (1 << 0)
#define S_MON (1 << 1)
#define S_YDAY (1 << 2)
#define S_MDAY (1 << 3)
#define S_WDAY (1 << 4)
#define HAVE_MDAY(s) (s & S_MDAY)
#define HAVE_MON(s) (s & S_MON)
#define HAVE_WDAY(s) (s & S_WDAY)
#define HAVE_YDAY(s) (s & S_YDAY)
#define HAVE_YEAR(s) (s & S_YEAR)
//static char gmt[] = { "GMT" };
static char utc[] = { "UTC" };
/* RFC-822/RFC-2822 */
static const char * const nast[5] = {
"EST", "CST", "MST", "PST", "\0\0\0"
};
static const char * const nadt[5] = {
"EDT", "CDT", "MDT", "PDT", "\0\0\0"
};
/*
* Table to determine the ordinal date for the start of a month.
* Ref: http://en.wikipedia.org/wiki/ISO_week_date
*/
static const int start_of_month[2][13] = {
/* non-leap year */
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
/* leap year */
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
};
/*
* Calculate the week day of the first day of a year. Valid for
* the Gregorian calendar, which began Sept 14, 1752 in the UK
* and its colonies. Ref:
* http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week
*/
static int
first_wday_of(int yr)
{
return ((2 * (3 - (yr / 100) % 4)) + (yr % 100) + ((yr % 100) / 4) +
(isleap(yr) ? 6 : 0) + 1) % 7;
}
char* _strptime(
const char *buf,
const char *fmt,
struct tm *tm,
struct lc_time_T* loc
);
char* ASM strptime(
REG(a0, const char *buf),
REG(a1, const char *fmt),
REG(a2, struct tm *tm)
)
{
return _strptime(buf, fmt, tm, (struct lc_time_T*)&C_time_locale);
}
char* ASM strptime_l(
REG(a0, const char *buf),
REG(a1, const char *fmt),
REG(a2, struct tm *tm),
REG(a3, locale_t locale)
)
{
char* res;
struct lc_time_T* l = openlc(locale);
res = _strptime(buf, fmt, tm, l);
closelc(l);
return res;
}
char* _strptime(
const char *buf,
const char *fmt,
struct tm *tm,
struct lc_time_T* loc
)
{
unsigned char c;
const unsigned char *bp, *ep;
int alt_format, i, split_year = 0, neg = 0, state = 0,
day_offset = -1, week_offset = 0, offs;
const char *new_fmt = NULL;
bp = (const u_char *)buf;
while (bp != NULL && (c = *fmt++) != '\0') {
/* Clear `alternate' modifier prior to new conversion. */
alt_format = 0;
i = 0;
/* Eat up white-space. */
if (isspace(c)) {
while (isspace(*bp))
bp++;
continue;
}
if (c != '%')
goto literal;
again:
switch (c = *fmt++) {
case '%': /* "%%" is converted to "%". */
literal:
if (c != *bp++)
return NULL;
LEGAL_ALT(0);
continue;
/*
* "Alternative" modifiers. Just set the appropriate flag
* and start over again.
*/
case 'E': /* "%E?" alternative conversion modifier. */
LEGAL_ALT(0);
alt_format |= ALT_E;
goto again;
case 'O': /* "%O?" alternative conversion modifier. */
LEGAL_ALT(0);
alt_format |= ALT_O;
goto again;
/*
* "Complex" conversion rules, implemented through recursion.
*/
case 'c': /* Date and time, using the locale's format. */
new_fmt = loc->date_fmt;
state |= S_WDAY | S_MON | S_MDAY | S_YEAR;
goto recurse;
case 'D': /* The date as "%m/%d/%y". */
new_fmt = "%m/%d/%y";
LEGAL_ALT(0);
state |= S_MON | S_MDAY | S_YEAR;
goto recurse;
case 'F': /* The date as "%Y-%m-%d". */
new_fmt = "%Y-%m-%d";
LEGAL_ALT(0);
state |= S_MON | S_MDAY | S_YEAR;
goto recurse;
case 'R': /* The time as "%H:%M". */
new_fmt = "%H:%M";
LEGAL_ALT(0);
goto recurse;
case 'r': /* The time in 12-hour clock representation. */
new_fmt = loc->c_fmt;
LEGAL_ALT(0);
goto recurse;
case 'T': /* The time as "%H:%M:%S". */
new_fmt = "%H:%M:%S";
LEGAL_ALT(0);
goto recurse;
case 'X': /* The time, using the locale's format. */
new_fmt = loc->X_fmt;
goto recurse;
case 'x': /* The date, using the locale's format. */
new_fmt = loc->x_fmt;
state |= S_MON | S_MDAY | S_YEAR;
recurse:
bp = (const u_char *)strptime((const char *)bp,
new_fmt, tm);
LEGAL_ALT(ALT_E);
continue;
/*
* "Elementary" conversion rules.
*/
case 'A': /* The day of week, using the locale's form. */
case 'a':
bp = find_string(bp, &tm->tm_wday,
loc->weekday, loc->wday, 7);
LEGAL_ALT(0);
state |= S_WDAY;
continue;
case 'B': /* The month, using the locale's form. */
case 'b':
case 'h':
bp = find_string(bp, &tm->tm_mon,
loc->month, loc->mon,
12);
LEGAL_ALT(0);
state |= S_MON;
continue;
case 'C': /* The century number. */
i = 20;
bp = conv_num(bp, &i, 0, 99);
i = i * 100 - TM_YEAR_BASE;
if (split_year)
i += tm->tm_year % 100;
split_year = 1;
tm->tm_year = i;
LEGAL_ALT(ALT_E);
state |= S_YEAR;
continue;
case 'd': /* The day of month. */
case 'e':
bp = conv_num(bp, &tm->tm_mday, 1, 31);
LEGAL_ALT(ALT_O);
state |= S_MDAY;
continue;
case 'k': /* The hour (24-hour clock representation). */
LEGAL_ALT(0);
/* FALLTHROUGH */
case 'H':
bp = conv_num(bp, &tm->tm_hour, 0, 23);
LEGAL_ALT(ALT_O);
continue;
case 'l': /* The hour (12-hour clock representation). */
LEGAL_ALT(0);
/* FALLTHROUGH */
case 'I':
bp = conv_num(bp, &tm->tm_hour, 1, 12);
if (tm->tm_hour == 12)
tm->tm_hour = 0;
LEGAL_ALT(ALT_O);
continue;
case 'j': /* The day of year. */
i = 1;
bp = conv_num(bp, &i, 1, 366);
tm->tm_yday = i - 1;
LEGAL_ALT(0);
state |= S_YDAY;
continue;
case 'M': /* The minute. */
bp = conv_num(bp, &tm->tm_min, 0, 59);
LEGAL_ALT(ALT_O);
continue;
case 'm': /* The month. */
i = 1;
bp = conv_num(bp, &i, 1, 12);
tm->tm_mon = i - 1;
LEGAL_ALT(ALT_O);
state |= S_MON;
continue;
case 'p': /* The locale's equivalent of AM/PM. */
bp = find_string(bp, &i, (const char* const*)loc->am,
NULL, 2);
if (tm->tm_hour > 11)
return NULL;
tm->tm_hour += i * 12;
LEGAL_ALT(0);
continue;
case 'S': /* The seconds. */
bp = conv_num(bp, &tm->tm_sec, 0, 61);
LEGAL_ALT(ALT_O);
continue;
case 's': /* seconds since the epoch */
{
time_t sse = 0;
uint64_t rulim = TIME_MAX;
if (*bp < '0' || *bp > '9') {
bp = NULL;
continue;
}
do {
sse *= 10;
sse += *bp++ - '0';
rulim /= 10;
} while ((sse * 10 <= TIME_MAX) &&
rulim && *bp >= '0' && *bp <= '9');
if (sse < 0 || (uint64_t)sse > TIME_MAX) {
bp = NULL;
continue;
}
if (localtime_r(&sse, tm) == NULL)
bp = NULL;
else
state |= S_YDAY | S_WDAY |
S_MON | S_MDAY | S_YEAR;
}
continue;
case 'U': /* The week of year, beginning on sunday. */
case 'W': /* The week of year, beginning on monday. */
/*
* XXX This is bogus, as we can not assume any valid
* information present in the tm structure at this
* point to calculate a real value, so just check the
* range for now.
*/
bp = conv_num(bp, &i, 0, 53);
LEGAL_ALT(ALT_O);
if (c == 'U')
day_offset = TM_SUNDAY;
else
day_offset = TM_MONDAY;
week_offset = i;
continue;
case 'w': /* The day of week, beginning on sunday. */
bp = conv_num(bp, &tm->tm_wday, 0, 6);
LEGAL_ALT(ALT_O);
state |= S_WDAY;
continue;
case 'u': /* The day of week, monday = 1. */
bp = conv_num(bp, &i, 1, 7);
tm->tm_wday = i % 7;
LEGAL_ALT(ALT_O);
state |= S_WDAY;
continue;
case 'g': /* The year corresponding to the ISO week
* number but without the century.
*/
bp = conv_num(bp, &i, 0, 99);
continue;
case 'G': /* The year corresponding to the ISO week
* number with century.
*/
do
bp++;
while (isdigit(*bp));
continue;
case 'V': /* The ISO 8601:1988 week number as decimal */
bp = conv_num(bp, &i, 0, 53);
continue;
case 'Y': /* The year. */
i = TM_YEAR_BASE; /* just for data sanity... */
bp = conv_num(bp, &i, 0, 9999);
tm->tm_year = i - TM_YEAR_BASE;
LEGAL_ALT(ALT_E);
state |= S_YEAR;
continue;
case 'y': /* The year within 100 years of the epoch. */
/* LEGAL_ALT(ALT_E | ALT_O); */
bp = conv_num(bp, &i, 0, 99);
if (split_year)
/* preserve century */
i += (tm->tm_year / 100) * 100;
else {
split_year = 1;
if (i <= 68)
i = i + 2000 - TM_YEAR_BASE;
else
i = i + 1900 - TM_YEAR_BASE;
}
tm->tm_year = i;
state |= S_YEAR;
continue;
case 'Z':
tzset();
if (strncmp((const char *)bp, gmt, 3) == 0 ||
strncmp((const char *)bp, utc, 3) == 0) {
tm->tm_isdst = 0;
tm->tm_gmtoff = 0;
tm->tm_zone = (char*)gmt;
bp += 3;
} else {
ep = find_string(bp, &i,
(const char * const *)tzname,
NULL, 2);
if (ep != NULL) {
tm->tm_isdst = i;
tm->tm_gmtoff = -(timezone);
tm->tm_zone = tzname[i];
}
bp = ep;
}
continue;
case 'z':
/*
* We recognize all ISO 8601 formats:
* Z = Zulu time/UTC
* [+-]hhmm
* [+-]hh:mm
* [+-]hh
* We recognize all RFC-822/RFC-2822 formats:
* UT|GMT
* North American : UTC offsets
* E[DS]T = Eastern : -4 | -5
* C[DS]T = Central : -5 | -6
* M[DS]T = Mountain: -6 | -7
* P[DS]T = Pacific : -7 | -8
* Military
* [A-IL-M] = -1 ... -9 (J not used)
* [N-Y] = +1 ... +12
*/
while (isspace(*bp))
bp++;
switch (*bp++) {
case 'G':
if (*bp++ != 'M')
return NULL;
/*FALLTHROUGH*/
case 'U':
if (*bp++ != 'T')
return NULL;
/*FALLTHROUGH*/
case 'Z':
tm->tm_isdst = 0;
tm->tm_gmtoff = 0;
tm->tm_zone = utc;
continue;
case '+':
neg = 0;
break;
case '-':
neg = 1;
break;
default:
--bp;
ep = find_string(bp, &i, nast, NULL, 4);
if (ep != NULL) {
tm->tm_gmtoff = -5 - i;
tm->tm_zone = (char*)(nast[i]);
bp = ep;
continue;
}
ep = find_string(bp, &i, nadt, NULL, 4);
if (ep != NULL) {
tm->tm_isdst = 1;
tm->tm_gmtoff = -4 - i;
tm->tm_zone = (char*)(nadt[i]);
bp = ep;
continue;
}
if ((*bp >= 'A' && *bp <= 'I') ||
(*bp >= 'L' && *bp <= 'Y')) {
/* Argh! No 'J'! */
if (*bp >= 'A' && *bp <= 'I')
tm->tm_gmtoff =
('A' - 1) - (int)*bp;
else if (*bp >= 'L' && *bp <= 'M')
tm->tm_gmtoff = 'A' - (int)*bp;
else if (*bp >= 'N' && *bp <= 'Y')
tm->tm_gmtoff = (int)*bp - 'M';
tm->tm_zone = NULL; /* XXX */
bp++;
continue;
}
return NULL;
}
offs = 0;
for (i = 0; i < 4; ) {
if (isdigit(*bp)) {
offs = offs * 10 + (*bp++ - '0');
i++;
continue;
}
if (i == 2 && *bp == ':') {
bp++;
continue;
}
break;
}
switch (i) {
case 2:
offs *= 100;
break;
case 4:
i = offs % 100;
if (i >= 60)
return NULL;
/* Convert minutes into decimal */
offs = (offs / 100) * 100 + (i * 50) / 30;
break;
default:
return NULL;
}
if (neg)
offs = -offs;
tm->tm_isdst = 0; /* XXX */
tm->tm_gmtoff = offs;
tm->tm_zone = NULL; /* XXX */
continue;
/*
* Miscellaneous conversions.
*/
case 'n': /* Any kind of white-space. */
case 't':
while (isspace(*bp))
bp++;
LEGAL_ALT(0);
continue;
default: /* Unknown/unsupported conversion. */
return NULL;
}
}
if (!HAVE_YDAY(state) && HAVE_YEAR(state)) {
if (HAVE_MON(state) && HAVE_MDAY(state)) {
/* calculate day of year (ordinal date) */
tm->tm_yday = start_of_month[isleap_sum(tm->tm_year,
TM_YEAR_BASE)][tm->tm_mon] + (tm->tm_mday - 1);
state |= S_YDAY;
} else if (day_offset != -1) {
/*
* Set the date to the first Sunday (or Monday)
* of the specified week of the year.
*/
if (!HAVE_WDAY(state)) {
tm->tm_wday = day_offset;
state |= S_WDAY;
}
tm->tm_yday = (7 -
first_wday_of(tm->tm_year + TM_YEAR_BASE) +
day_offset) % 7 + (week_offset - 1) * 7 +
tm->tm_wday - day_offset;
state |= S_YDAY;
}
}
if (HAVE_YDAY(state) && HAVE_YEAR(state)) {
int isleap;
if (!HAVE_MON(state)) {
/* calculate month of day of year */
i = 0;
isleap = isleap_sum(tm->tm_year, TM_YEAR_BASE);
while (tm->tm_yday >= start_of_month[isleap][i])
i++;
if (i > 12) {
i = 1;
tm->tm_yday -= start_of_month[isleap][12];
tm->tm_year++;
}
tm->tm_mon = i - 1;
state |= S_MON;
}
if (!HAVE_MDAY(state)) {
/* calculate day of month */
isleap = isleap_sum(tm->tm_year, TM_YEAR_BASE);
tm->tm_mday = tm->tm_yday -
start_of_month[isleap][tm->tm_mon] + 1;
state |= S_MDAY;
}
if (!HAVE_WDAY(state)) {
/* calculate day of week */
i = 0;
week_offset = first_wday_of(tm->tm_year);
while (i++ <= tm->tm_yday) {
if (week_offset++ >= 6)
week_offset = 0;
}
tm->tm_wday = week_offset;
state |= S_WDAY;
}
}
return (char*)(bp);
}
static const u_char *
conv_num(const unsigned char *buf, int *dest, uint llim, uint ulim)
{
uint result = 0;
unsigned char ch;
/* The limit also determines the number of valid digits. */
uint rulim = ulim;
ch = *buf;
if (ch < '0' || ch > '9')
return NULL;
do {
result *= 10;
result += ch - '0';
rulim /= 10;
ch = *++buf;
} while ((result * 10 <= ulim) && rulim && ch >= '0' && ch <= '9');
if (result < llim || result > ulim)
return NULL;
*dest = result;
return buf;
}
static const u_char *
find_string(const u_char *bp, int *tgt, const char * const *n1,
const char * const *n2, int c)
{
int i;
size_t len;
/* check full name - then abbreviated ones */
for (; n1 != NULL; n1 = n2, n2 = NULL) {
for (i = 0; i < c; i++, n1++) {
len = strlen(*n1);
if (strncasecmp(*n1, (const char *)bp, len) == 0) {
*tgt = i;
return bp + len;
}
}
}
/* Nothing matched */
return NULL;
}
+74 -50
View File
@@ -1,20 +1,18 @@
//--------------------------------------------------------------------------//
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "lib_macros.h"
#include "time_proto.h"
// -------------------------------------------------------------------------- //
#include "time_header.h"
#include <dos/var.h>
#include <devices/timer.h>
#include <libraries/locale.h>
// 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
/**
*
* @brief
* The time () function returns the value of time in seconds since 0 hours,
* 0 minutes, 0 seconds, January 1, 1970, Coordinated Universal Time. If an
@@ -23,69 +21,42 @@
* The return value is also stored in * tloc , provided that tloc is non-null.
*
*/
#include "compiler.h"
#include "lib_macros.h"
#include "time_proto.h"
#include <dos/var.h>
#include <devices/timer.h>
#include <libraries/locale.h>
time_t ASM time(
REG(a0, time_t *tloc)
)
{
struct timeval tv;
long zone;
time_t time;
struct timeval tv;
if (CreateTimer() != 0) {
return 0;
}
GetSysTime(&tv);
time = (time_t)(tv.tv_secs + AMIGAOFFSET);
time = time - gmtoffset(time);
zone = (daylight == 0 ? timezone : altzone);
time = (time_t)(tv.tv_secs + AMIGAOFFSET + zone);
if (tloc) {
*tloc = time;
}
DeleteTimer();
return time;
}
int ASM gmtoffset(
REG(d0, time_t locale_time)
)
{
struct tm tm;
time_t time = locale_time;
localtime_rz(lclptr, &time, &tm);
mktime(&tm);
return tm.tm_gmtoff;
}
void ASM getsystime(
REG(a0, struct timeval *tv)
)
{
GetSysTime(tv);
}
void ASM setsystime(
REG(a0, struct timeval *tv)
)
{
TimeRequest->tr_node.io_Command = TR_SETSYSTIME;
TimeRequest->tr_time.tv_secs = (long)tv->tv_secs;
TimeRequest->tr_time.tv_micro = tv->tv_micro;
DoIO((struct IORequest*)TimeRequest);
}
int ASM gettimeofday(
REG(a0, struct timeval *tv),
REG(a1, const timezone_t tz)
)
{
struct tm tm;
time_t time;
struct tm tm;
if (CreateTimer() != 0) {
return -1;
}
TimeRequest->tr_node.io_Command = TR_GETSYSTIME;
DoIO((struct IORequest*)TimeRequest);
@@ -99,6 +70,7 @@ int ASM gettimeofday(
tv->tv_secs = mktime_z(tz, &tm);
}
DeleteTimer();
return 0;
}
@@ -107,6 +79,10 @@ int ASM settimeofday(
REG(a1, const timezone_t tz)
)
{
if (CreateTimer() != 0) {
return -1;
}
// TODO: Include timezone in logic
TimeRequest->tr_node.io_Command = TR_SETSYSTIME;
@@ -114,5 +90,53 @@ int ASM settimeofday(
TimeRequest->tr_time.tv_micro = tv->tv_micro;
DoIO((struct IORequest*)TimeRequest);
DeleteTimer();
return 0;
}
int ASM getsystime(
REG(a0, struct timeval *tv)
)
{
struct timeval tv1;
if (CreateTimer() != 0) {
tv->tv_secs = 0;
tv->tv_micro = 0;
return -1;
}
GetSysTime(&tv1);
*tv = tv1;
DeleteTimer();
return 0;
}
int ASM setsystime(
REG(a0, struct timeval *tv)
)
{
if (CreateTimer() != 0) {
return -1;
}
TimeRequest->tr_node.io_Command = TR_SETSYSTIME;
TimeRequest->tr_time.tv_secs = (long)tv->tv_secs;
TimeRequest->tr_time.tv_micro = tv->tv_micro;
DoIO((struct IORequest*)TimeRequest);
DeleteTimer();
return 0;
}
int ASM gmtoffset(
REG(d0, time_t locale_time)
)
{
struct tm tm;
time_t time = locale_time;
localtime_rz(lclptr, &time, &tm);
mktime(&tm);
return tm.tm_gmtoff;
}
+48 -23
View File
@@ -1,41 +1,66 @@
//--------------------------------------------------------------------------//
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "lib_mem.h"
#include "time_types.h"
#include <devices/timer.h>
// This file is in the public domain. //
//--------------------------------------------------------------------------//
bool OpenTimer()
#include "time_header.h"
#include <devices/timer.h>
struct Device* TimerBase;
struct MsgPort* TimerPort;
struct timerequest* TimeRequest;
int CreateTimer()
{
int error;
TimeRequest = allocmem(sizeof(struct timerequest));
if (!TimeRequest) {
return false;
TimerPort = CreateMsgPort();
if (TimerPort == NULL) {
return 1;
}
error = OpenDevice((STRPTR)TIMERNAME, UNIT_MICROHZ, (struct IORequest*)TimeRequest, 0L);
TimeRequest = (struct timerequest*)CreateIORequest(
TimerPort,
sizeof(struct timerequest)
);
if (TimeRequest == NULL) {
DeleteMsgPort(TimerPort);
return 2;
}
error = OpenDevice(
(STRPTR)TIMERNAME,
UNIT_MICROHZ,
(struct IORequest*)TimeRequest,
0
);
if (error != 0)
{
freemem(TimeRequest);
return false;
DeleteIORequest((struct IORequest*)TimeRequest);
DeleteMsgPort(TimerPort);
return 3;
}
TimerBase = (struct Device*)TimeRequest->tr_node.io_Device;
return true;
return 0;
}
bool CloseTimer()
void DeleteTimer()
{
CloseDevice((struct IORequest*)TimeRequest);
freemem(TimeRequest);
if (TimeRequest != NULL) {
if (!CheckIO((struct IORequest*)TimeRequest)) {
WaitIO((struct IORequest*)TimeRequest);
}
TimerBase = NULL;
TimeRequest = NULL;
CloseDevice((struct IORequest*)TimeRequest);
DeleteIORequest((struct IORequest*)TimeRequest);
return true;
TimeRequest = NULL;
}
if (TimerPort != NULL) {
DeleteMsgPort(TimerPort);
TimerPort = NULL;
}
}
//--------------------------------------------------------------------------//
+20 -26
View File
@@ -2,18 +2,14 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "time_types.h"
#include "time_state.h"
#include "time_proto.h"
#include "time_length.h"
//--------------------------------------------------------------------------//
/*
** Return the number of leap years through the end of the given year
** where, to make the math easy, the answer for year zero is defined as zero.
*/
#include "time_header.h"
/**
* Return the number of leap years through the end of the given year
* where, to make the math easy, the answer for year zero is defined as zero.
*
*/
static int leaps_thru_end_of(const int y)
{
return (y >= 0) ?
@@ -27,15 +23,15 @@ struct tm *timesub(
const struct state *const sp,
struct tm *const tmp)
{
const struct lsinfo * lp;
time_t tdays;
int idays; /* unsigned would be so 2003 */
int_fast64_t rem;
int y;
const int * ip;
int_fast64_t corr;
bool hit;
int i;
const struct lsinfo *lp;
time_t tdays;
int idays; // unsigned would be so 2003
int_fast64_t rem;
int y;
const int *ip;
int_fast64_t corr;
bool hit;
int i;
corr = 0;
hit = false;
@@ -67,10 +63,10 @@ struct tm *timesub(
rem = *timep - tdays * SECSPERDAY;
while (tdays < 0 || tdays >= year_lengths[isleap(y)]) {
int newy;
time_t tdelta;
int idelta;
int leapdays;
int newy;
time_t tdelta;
int idelta;
int leapdays;
tdelta = tdays / DAYSPERLYEAR;
if (! ((! TYPE_SIGNED(time_t) || INT_MIN <= tdelta)
@@ -89,7 +85,7 @@ struct tm *timesub(
y = newy;
}
{
int_fast32_t seconds;
int_fast32_t seconds;
seconds = tdays * SECSPERDAY;
tdays = seconds / SECSPERDAY;
@@ -155,5 +151,3 @@ out_of_range:
errno = EOVERFLOW;
return NULL;
}
//--------------------------------------------------------------------------//
+16 -16
View File
@@ -1,24 +1,24 @@
//--------------------------------------------------------------------------//
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#ifndef _TIME_TM_H
#define _TIME_TM_H
//--------------------------------------------------------------------------//
extern char *tzname[2];
//--------------------------------------------------------------------------//
struct tm {
int tm_sec; /* seconds after the minute [0-61] */
int tm_min; /* minutes after the hour [0-59] */
int tm_hour; /* hours since midnight [0-23] */
int tm_mday; /* day of the month [1-31] */
int tm_mon; /* months since January [0-11] */
int tm_year; /* years since 1900 */
int tm_wday; /* days since Sunday [0-6] */
int tm_yday; /* days since January 1 [0-365] */
int tm_isdst; /* Daylight Savings Time flag */
long tm_gmtoff; /* offset from UTC in seconds */
char *tm_zone; /* timezone abbreviation */
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
long tm_gmtoff;
char *tm_zone;
};
//--------------------------------------------------------------------------//
#endif
+17 -16
View File
@@ -2,12 +2,13 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#ifndef _TIME_TYPES_H
#define _TIME_TYPES_H
//--------------------------------------------------------------------------//
#include "compiler.h"
#include <limits.h>
//--------------------------------------------------------------------------//
#include <errno.h>
#ifndef ENAMETOOLONG
# define ENAMETOOLONG EINVAL
@@ -15,9 +16,9 @@
#ifndef EOVERFLOW
# define EOVERFLOW EINVAL
#endif
//--------------------------------------------------------------------------//
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
//--------------------------------------------------------------------------//
#define is_digit(c) isdigit(c)
// Pre-C99 GCC compilers define __LONG_LONG_MAX__ instead of LLONG_MAX.
#ifdef __LONG_LONG_MAX__
# ifndef LLONG_MAX
@@ -27,7 +28,7 @@
# define LLONG_MIN (-1 - LLONG_MAX)
# endif
#endif
//--------------------------------------------------------------------------//
#ifndef INT_FAST64_MAX
# ifdef LLONG_MAX
typedef long long int_fast64_t;
@@ -42,7 +43,7 @@ typedef long int_fast64_t;
# define INT_FAST64_MAX LONG_MAX
# endif
#endif
//--------------------------------------------------------------------------//
#ifndef INT_FAST32_MAX
# if INT_MAX >> 31 == 0
typedef long int_fast32_t;
@@ -54,7 +55,7 @@ typedef int int_fast32_t;
# define INT_FAST32_MIN INT_MIN
# endif
#endif
//--------------------------------------------------------------------------//
#ifndef INTMAX_MAX
# ifdef LLONG_MAX
typedef long long intmax_t;
@@ -68,7 +69,7 @@ typedef long intmax_t;
# define INTMAX_MIN LONG_MIN
# endif
#endif
//--------------------------------------------------------------------------//
#ifndef UINTMAX_MAX
# if defined ULLONG_MAX || defined __LONG_LONG_MAX__
typedef unsigned long long uintmax_t;
@@ -76,14 +77,14 @@ typedef unsigned long long uintmax_t;
typedef unsigned long uintmax_t;
# endif
#endif
//--------------------------------------------------------------------------//
#ifndef TYPE_BIT
# define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
#endif
#ifndef TYPE_SIGNED
# define TYPE_SIGNED(type) (((type) -1) < 0)
#endif
//--------------------------------------------------------------------------//
#define TWOS_COMPLEMENT(t) ((t) ~ (t) 0 < 0)
/* Max and min values of the integer type T, of which only the bottom
@@ -95,13 +96,13 @@ typedef unsigned long uintmax_t;
#define MINVAL(t, b) \
((t) (TYPE_SIGNED(t) ? - TWOS_COMPLEMENT(t) - MAXVAL(t, b) : 0))
//--------------------------------------------------------------------------//
// The minimum and maximum finite time values. This assumes no padding.
extern time_t const time_t_min;
extern time_t const time_t_max;
//--------------------------------------------------------------------------//
#define GRANDPARENTED "Local time zone must be set"
//--------------------------------------------------------------------------//
#define GRANDPARENTED "Local time zone must be set--see zic manual page"
#ifndef TZ_ABBR_MAX_LEN
# define TZ_ABBR_MAX_LEN 16
#endif
@@ -112,5 +113,5 @@ extern time_t const time_t_max;
#ifndef TZ_ABBR_ERR_CHAR
# define TZ_ABBR_ERR_CHAR '_'
#endif
//--------------------------------------------------------------------------//
#endif
+7 -11
View File
@@ -2,27 +2,25 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_tm.h"
#include "compiler.h"
#include "lib_mem.h"
#include "time_proto.h"
#include "time_state.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
timezone_t ASM tzalloc(REG(a0, char const *name))
{
struct state *sp;
unsigned long memsize;
if (!name || name[0] == '\0') {
if (name == NULL || name[0] == '\0') {
return NULL;
}
sp = (struct state*)allocmem(sizeof(timezone_t));
memsize = sizeof(struct state);
sp = (struct state*)AllocMem(memsize, MEMF_PUBLIC | MEMF_CLEAR);
if (sp) {
int err = zoneinit(sp, name);
if (err != 0) {
freemem(sp);
FreeMem(sp, memsize);
errno = err;
return NULL;
}
@@ -30,5 +28,3 @@ timezone_t ASM tzalloc(REG(a0, char const *name))
return (timezone_t)sp;
}
//--------------------------------------------------------------------------//
+8 -6
View File
@@ -2,6 +2,7 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
/*
** This header is for use ONLY with the time conversion code.
** There is no guarantee that it will remain unchanged,
@@ -9,13 +10,14 @@
** Do NOT copy it to any system include directory.
** Thank you!
*/
//--------------------------------------------------------------------------//
#ifndef _TIME_TZFILE_H
#define _TIME_TZFILE_H
//--------------------------------------------------------------------------//
/*
** Information about time zone files.
*/
/**
* Information about time zone files.
*
*/
#include "compiler.h"
@@ -150,5 +152,5 @@ struct tzhead {
*/
#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400)
//--------------------------------------------------------------------------//
#endif
+4 -9
View File
@@ -2,17 +2,12 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "lib_mem.h"
#include "lib_macros.h"
#include "time_state.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
void ASM tzfree(REG(a0, timezone_t sp))
{
if (sp) {
freemem(sp);
if (sp != NULL) {
FreeMem(sp, sizeof(struct state));
}
}
//--------------------------------------------------------------------------//
+62 -24
View File
@@ -2,12 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "lib_mem.h"
#include "time_types.h"
#include "time_proto.h"
#include "time_length.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
int_fast32_t detzcode(const char *const codep)
{
@@ -112,6 +108,50 @@ union local_storage {
} u;
};
int openzonefile(char *name, BPTR *file)
{
BPTR lock;
struct FileInfoBlock *fib;
int error = 0;
fib = AllocDosObject(DOS_FIB, NULL);
if (fib == NULL) {
return 1;
}
lock = Lock((STRPTR)name, ACCESS_READ);
if (lock == 0) {
FreeDosObject(DOS_FIB, fib);
return 2;
}
if (Examine(lock, fib) == 0) {
error = 3;
}
if (error == 0 && fib->fib_DirEntryType > 0) {
error = 4;
}
if (error == 0 && fib->fib_Size < sizeof(struct tzhead)) {
error = 5;
}
FreeDosObject(DOS_FIB, fib);
if (error == 0) {
*file = OpenFromLock(lock);
if (*file == 0) {
error = 6;
} else {
lock = 0;
}
}
UnLock(lock);
return error;
}
/* Load tz data from the file named NAME into *SP. Read extended
format if DOEXTEND. Use *LSP for temporary storage. Return 0 on
success, an errno value on failure. */
@@ -122,7 +162,8 @@ int tzloadbody(
union local_storage *lsp
)
{
BPTR lock, file;
BPTR file;
int err;
long c;
int i;
int stored;
@@ -135,7 +176,7 @@ int tzloadbody(
sp->goback = sp->goahead = false;
if (!name || name[0] == '\0') {
if (name == NULL || name[0] == '\0') {
name = TZDEFAULT;
}
@@ -146,16 +187,8 @@ int tzloadbody(
strcat(fullname, name);
name = fullname;
lock = Lock((STRPTR)name, ACCESS_READ);
if (!lock) {
return IoErr();
}
file = OpenFromLock(lock);
if (!file) {
i = IoErr();
UnLock(lock);
return i;
if ((err = openzonefile(fullname, &file)) != 0) {
return -(10 + err);
}
nread = 0;
@@ -167,12 +200,15 @@ int tzloadbody(
}
if (nread < tzheadsize) {
// File too short
Close(file);
return IoErr();
return -2;
}
if (!Close(file))
return IoErr();
if (Close(file) == 0) {
// Something went really wrong
return -3;
}
for (stored = 4; stored <= 8; stored *= 2) {
int_fast32_t ttisstdcnt = detzcode(up->tzhead.tzh_ttisstdcnt);
@@ -406,17 +442,19 @@ int tzloadbody(
format if DOEXTEND. Return 0 on success, an errno value on failure. */
int tzload(char const *name, struct state *sp, bool doextend)
{
unsigned long memsize = sizeof(union local_storage);
union local_storage *lsp =
(union local_storage*)
allocmem(sizeof(union local_storage));
AllocMem(memsize, MEMF_ANY | MEMF_CLEAR);
if (!lsp) {
return errno;
} else {
int err = tzloadbody(name, sp, doextend, lsp);
freemem(lsp);
FreeMem(lsp, memsize);
return err;
}
}
//--------------------------------------------------------------------------//
+26 -7
View File
@@ -1,12 +1,9 @@
//--------------------------------------------------------------------------//
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "lib_macros.h"
#include "time_state.h"
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include "time_header.h"
char* ASM tzlocation(void)
{
static char nowhere[2] = "";
@@ -18,4 +15,26 @@ char* ASM tzlocation(void)
}
}
//--------------------------------------------------------------------------//
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++;
}
}
+3 -7
View File
@@ -2,12 +2,10 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_tzfile.h"
#include "time_header.h"
#include "time_rule.h"
#include "time_state.h"
#include "time_proto.h"
#include "time_length.h"
//--------------------------------------------------------------------------//
/*
** Given a pointer into a time zone string, scan until a character that is not
** a valid character in a zone name is found. Return a pointer to that
@@ -529,5 +527,3 @@ bool tzparse(
}
return true;
}
//--------------------------------------------------------------------------//
+2 -4
View File
@@ -2,8 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
void tzset(void)
{
@@ -14,5 +14,3 @@ void tzset(void)
unlock();
}
//--------------------------------------------------------------------------//
+7 -15
View File
@@ -2,30 +2,22 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "lib_mem.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
#include <dos/var.h>
//--------------------------------------------------------------------------//
void tzset_unlocked(void)
{
unsigned long memsize = ENVSIZE;
STRPTR var = (STRPTR)TZVARIABLE;
STRPTR buf = (char*)allocmem(ENVSIZE);
STRPTR buf = (char*)AllocMem(memsize, MEMF_ANY | MEMF_CLEAR);
if (!buf) {
return;
}
if (GetVar(var, buf, ENVSIZE - 1, GVF_GLOBAL_ONLY) == -1) {
freemem(buf);
return;
};
GetVar(var, buf, ENVSIZE - 1, GVF_GLOBAL_ONLY);
tzsetlcl(buf);
freemem(buf);
FreeMem(buf, memsize);
}
//--------------------------------------------------------------------------//
+5 -8
View File
@@ -2,11 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "lib_mem.h"
#include "time_state.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
void tzsetlcl(char const *name)
{
@@ -17,7 +14,9 @@ void tzsetlcl(char const *name)
}
if (!sp) {
lclptr = (struct state*)allocmem(sizeof(struct state));
lclptr = (struct state*)
AllocMem(sizeof(struct state), MEMF_PUBLIC | MEMF_CLEAR);
sp = lclptr;
}
@@ -35,5 +34,3 @@ void tzsetlcl(char const *name)
lcl_is_set = lcl;
}
//--------------------------------------------------------------------------//
+2 -5
View File
@@ -2,9 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_types.h"
#include "time_state.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
void update_tzname_etc(struct state const *sp, struct ttinfo const *ttisp)
{
@@ -16,5 +15,3 @@ void update_tzname_etc(struct state const *sp, struct ttinfo const *ttisp)
if (ttisp->tt_isdst)
altzone = - ttisp->tt_gmtoff;
}
//--------------------------------------------------------------------------//
+13 -13
View File
@@ -1,31 +1,31 @@
//--------------------------------------------------------------------------//
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#ifndef _TIME_VERSION_H
#define _TIME_VERSION_H
//--------------------------------------------------------------------------//
#define VERSION_NO 1
#define VERSION "VERSION_NO"
#define REVISION_NO 03
#define REVISION "REVISION_NO"
#define DATE "25.07.2015"
#define XSTR(s) STR(s)
#define STR(s) #s
#define VERSION_NO 2
#define VERSION XSTR(VERSION_NO)
#define REVISION_NO 00
#define REVISION XSTR(REVISION_NO)
#define DATE "30.07.2015"
#define PACKAGE_TZ "tzcode"
#define VERSION_TZ "2015e"
#define BUGEMAIL_TZ "carsten.larsen@mail.com"
#define AMIGA_VERSION " " VERSION "." REVISION " (" DATE ") " \
PACKAGE_TZ " " VERSION_TZ
//--------------------------------------------------------------------------//
static char const PKGVERSION[] = "(" PACKAGE_TZ ")";
static char const TZVERSION[] = VERSION_TZ;
static char const REPORT_BUGS_TO[] = BUGEMAIL_TZ;
//--------------------------------------------------------------------------//
// Library version definitions //
//--------------------------------------------------------------------------//
#define VERS "timezone.library " VERSION "." REVISION
#define VSTRING "timezone.library " VERSION "." REVISION \
"(" DATE ")\r\n"
#define VERSTAG "\0$VER: timezone.library " VERSION "." REVISION \
"(" DATE ")"
//--------------------------------------------------------------------------//
#endif
+2 -6
View File
@@ -2,10 +2,8 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#include "time_types.h"
#include "time_state.h"
#include "time_proto.h"
//--------------------------------------------------------------------------//
#include "time_header.h"
static void scrub_abbrs(struct state *sp);
@@ -60,5 +58,3 @@ static void scrub_abbrs(struct state *sp)
}
}
}
//--------------------------------------------------------------------------//
+6 -29
View File
@@ -1,36 +1,13 @@
/*
* 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. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include "time_tm.h"
#include "time_proto.h"
#include "time_header.h"
struct Device* TimerBase;
struct timerequest* TimeRequest;
struct Device* TimerBase;
struct timerequest* TimeRequest;
int main(const int argc, char *argv[])
{
+4 -26
View File
@@ -1,35 +1,13 @@
/*
* 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. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <exec/libraries.h>
#include "clib_timezone.h"
#include "timezone_inline.h"
struct Library *TimezoneBase = NULL;
struct Library *TimezoneBase;
int main(const int argc, char *argv[])
{
+4 -5
View File
@@ -1,6 +1,9 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include "compiler.h"
#include "time_proto.h"
#include "time_header.h"
#include <stdio.h>
struct Library* DOSBase;
@@ -44,9 +47,6 @@ int main(const int argc, char *argv[])
result = false;
}
if (LocaleBase) {
printf("Closing %s\n", LOCALELIB_NAME);
CloseLibrary(LocaleBase);
@@ -75,4 +75,3 @@ int main(const int argc, char *argv[])
return 0;
}
+4 -4
View File
@@ -1,10 +1,11 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include "proto/exec.h"
#include "compiler.h"
#include "time_tm.h"
#include "time_proto.h"
#include "time_header.h"
int main(const int argc, char *argv[])
{
@@ -27,6 +28,5 @@ int main(const int argc, char *argv[])
}
freemem(ret);
return 0;
}
+10 -1
View File
@@ -1,9 +1,18 @@
//--------------------------------------------------------------------------//
// 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
#include "proto/exec.h"
#include "time_tm.h"
#include "compiler.h"
#include "time_proto.h"
#include "time_header.h"
int main(const int argc, char *argv[])
{
+4 -4
View File
@@ -1,17 +1,17 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include "tzversion.h"
#include "private.h"
//--------------------------------------------------------------------------//
const char *vers = "\0$VER: tzdate" AMIGA_VERSION;
//--------------------------------------------------------------------------//
char ** environ = NULL;
void syslog(int pri, const char *fmt, ...) { }
void logwtmp(const char *line, const char *name, const char *host) { }
void lose(int i) { }
//--------------------------------------------------------------------------//
char* getlogin() {
return "Not implemented";
}
//--------------------------------------------------------------------------//
+5 -6
View File
@@ -1,18 +1,18 @@
//--------------------------------------------------------------------------//
// 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 = NULL;
//--------------------------------------------------------------------------//
struct Library *TimezoneBase;
int main(const int argc, char *argv[])
{
int result;
@@ -32,4 +32,3 @@ int main(const int argc, char *argv[])
CloseLibrary(TimezoneBase);
return result;
}
//--------------------------------------------------------------------------//
+13 -6
View File
@@ -63,7 +63,7 @@ struct tm {
};
#endif
//--------------------------------------------------------------------------//
void tzset();
void tzset(void);
timezone_t tzalloc(char const *name);
void tzfree(timezone_t tz);
time_t time(time_t *p);
@@ -79,14 +79,22 @@ char* ctime_r(const time_t *const timep, char *buf);
double difftime(const time_t time1, const time_t time0);
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, const 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);
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);
//--------------------------------------------------------------------------//
void getsystime(struct timeval *tv);
void setsystime(struct timeval *tv);
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);
@@ -98,4 +106,3 @@ void underscore_add(char *s);
void underscore_remove(char *s);
//--------------------------------------------------------------------------//
#endif
+34 -14
View File
@@ -11,6 +11,10 @@
#define TIMEZONE_BASE_NAME TimezoneBase
#endif /* !TIMEZONE_BASE_NAME */
#define altzone_c() \
LP0(0xa2, long, altzone_c, \
, TIMEZONE_BASE_NAME)
#define asctime(timeptr) \
LP1(0x72, char*, asctime, const struct tm *, timeptr, a0, \
, TIMEZONE_BASE_NAME)
@@ -27,19 +31,21 @@
LP2(0x66, char*, ctime_r, const time_t *const, timep, a0, char *, buf, a1, \
, TIMEZONE_BASE_NAME)
#define daylight_c() \
LP0(0x96, int, daylight_c, \
, TIMEZONE_BASE_NAME)
#define difftime(time1, time0) \
LP2(0x6c, 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(0xae, 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(0xba, int, gettimeofday, struct timeval *, tv, a0, const timezone_t, tz, a1, \
, TIMEZONE_BASE_NAME)
#endif
#define gmtime(timep) \
LP1(0x54, struct tm*, gmtime, const time_t *, timep, a0, \
@@ -50,7 +56,7 @@
, TIMEZONE_BASE_NAME)
#define gmtoffset(tloc) \
LP1(0xa2, int, gmtoffset, time_t, tloc, d0, \
LP1(0xc6, int, gmtoffset, time_t, tloc, d0, \
, TIMEZONE_BASE_NAME)
#define localtime(timep) \
@@ -74,27 +80,37 @@
, TIMEZONE_BASE_NAME)
#define setsystime(tv) \
LP1NR(0x90, setsystime, struct timeval *, tv, a0, \
LP1(0xb4, 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(0xc0, int, settimeofday, const struct timeval *, tv, a0, const timezone_t, tz, a1, \
, TIMEZONE_BASE_NAME)
#endif
#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(0x7e, 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(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, \
, 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, \
, 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, \
, TIMEZONE_BASE_NAME)
#define time(p) \
LP1(0x30, time_t, time, time_t *, p, a0, \
, TIMEZONE_BASE_NAME)
#define timezone_c() \
LP0(0x9c, long, timezone_c, \
, TIMEZONE_BASE_NAME)
#define tzalloc(name) \
LP1(0x24, timezone_t, tzalloc, char const *, name, a0, \
, TIMEZONE_BASE_NAME)
@@ -104,7 +120,11 @@
, TIMEZONE_BASE_NAME)
#define tzlocation() \
LP0(0xa8, char*, tzlocation, \
LP0(0xcc, char*, tzlocation, \
, TIMEZONE_BASE_NAME)
#define tzname_c() \
LP0(0xa8, char**, tzname_c, \
, TIMEZONE_BASE_NAME)
#define tzset() \
@@ -112,11 +132,11 @@
, TIMEZONE_BASE_NAME)
#define underscore_add(s) \
LP1NR(0xae, underscore_add, char *, s, a0, \
LP1NR(0xd2, underscore_add, char *, s, a0, \
, TIMEZONE_BASE_NAME)
#define underscore_remove(s) \
LP1NR(0xb4, underscore_remove, char *, s, a0, \
LP1NR(0xd8, underscore_remove, char *, s, a0, \
, TIMEZONE_BASE_NAME)
#endif /* !_INLINE_TIMEZONE_H */
+1
View File
@@ -2,6 +2,7 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#ifndef PRIVATE_H
#define PRIVATE_H
+5 -6
View File
@@ -1,14 +1,15 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <stdlib.h>
#include "tzversion.h"
#include "clib/timezone.h"
#include "inline/timezone.h"
//--------------------------------------------------------------------------//
const char *vers = "\0$VER: SetClockGMT" AMIGA_VERSION;
//--------------------------------------------------------------------------//
#define ARGSFORMAT "LOAD/S,SAVE/S,RESET/S"
struct progargs {
@@ -24,7 +25,7 @@ struct Library *DOSBase = NULL;
struct Library *UtilityBase = NULL;
struct Library *TimezoneBase = NULL;
struct Library *BattClockBase;
//--------------------------------------------------------------------------//
int main(int argc, char **argv)
{
int result;
@@ -63,11 +64,10 @@ int main(int argc, char **argv)
return 0;
}
//--------------------------------------------------------------------------//
void amiga_open_lib_error(char *name, int version)
{
FPrintf(Output(), (STRPTR)OPEN_VER_ERROR, name, version);
FPrintf(Output(), (STRPTR)REQ_ERROR, NULL);
}
int amiga_open_libs()
@@ -114,4 +114,3 @@ void amiga_close_libs()
DOSBase = NULL;
}
}
//--------------------------------------------------------------------------//
+2 -4
View File
@@ -30,7 +30,7 @@
* $NetBSD: strtoll.c,v 1.7 2004/08/31 17:55:17 jlam Exp $
*
*/
//--------------------------------------------------------------------------//
/**
* @file strtoll.c
* @brief
@@ -40,7 +40,7 @@
*
* Originate from: strtoq.c 8.1 (Berkeley) 6/4/93
*/
//--------------------------------------------------------------------------//
#include "tzversion.h"
extern struct Locale* locale;
@@ -56,7 +56,6 @@ extern struct Locale* locale;
#ifndef LLONG_MIN
#define LLONG_MIN (-LLONG_MAX - 1)
#endif
//--------------------------------------------------------------------------//
long long int strtoll(const char *nptr, char **endptr, int base)
{
@@ -157,4 +156,3 @@ long long int strtoll(const char *nptr, char **endptr, int base)
*endptr = (char *)(any ? s - 1 : nptr);
return (acc);
}
//--------------------------------------------------------------------------//
+4 -21
View File
@@ -1,17 +1,17 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// --------------------------------------------------------------------------- //
#include "zone.h"
#include "tzversion.h"
#include "clib/timezone.h"
#include "inline/timezone.h"
// --------------------------------------------------------------------------- //
const char *vers = "\0$VER: TimeZone" AMIGA_VERSION;
// --------------------------------------------------------------------------- //
#define GID_LIST 1001
#define GID_TZ 1003
#define GID_USE_TZ 1004
@@ -27,7 +27,7 @@ const char *vers = "\0$VER: TimeZone" AMIGA_VERSION;
#define GetSucc(node) ((node) && (node)->ln_Succ->ln_Succ ? (node)->ln_Succ : NULL)
#define GetPred(node) ((node) && (node)->ln_Pred->ln_Pred ? (node)->ln_Pred : NULL)
#endif
// --------------------------------------------------------------------------- //
// Globals variables
char *tz = NULL;
struct Library *DOSBase = NULL;
@@ -57,12 +57,9 @@ void save_localtime();
void amiga_cleanup();
void copy_file(char *fromname, char *toname);
// --------------------------------------------------------------------------- //
void amiga_open_lib_error(char *name, int version)
{
FPrintf(Output(), (STRPTR)OPEN_VER_ERROR, name, version);
FPrintf(Output(), (STRPTR)REQ_ERROR, NULL);
}
int amiga_open_libs()
@@ -170,8 +167,6 @@ void amiga_cleanup()
}
}
// --------------------------------------------------------------------------- //
int amiga_open_window()
{
window = (struct Window*)OpenWindowTags (
@@ -254,8 +249,6 @@ void amiga_setup_gui()
height = ng.ng_TopEdge + ng.ng_Height + 4 + screen->WBorBottom;
}
// --------------------------------------------------------------------------- //
void load_tz()
{
if (tz != NULL) {
@@ -374,8 +367,6 @@ void show_tz()
GT_SetGadgetAttrs(tzgad, window, NULL, GTTX_Text, tztext, TAG_END);
}
// --------------------------------------------------------------------------- //
int cmploc (const void * a, const void * b)
{
struct Location *loca, *locb;
@@ -407,8 +398,6 @@ void populate_list()
}
}
// --------------------------------------------------------------------------- //
struct Node *get_node (struct List *list,ULONG num)
{
struct Node *node;
@@ -439,8 +428,6 @@ ULONG node_number (struct List *list,struct Node *node_to_find)
return (-1);
}
// --------------------------------------------------------------------------- //
int main (void)
{
int showindex;
@@ -536,8 +523,6 @@ int main (void)
return 0;
}
//--------------------------------------------------------------------------//
void copy_file(char *fromname, char *toname)
{
const int bufsize = 512;
@@ -577,5 +562,3 @@ void copy_file(char *fromname, char *toname)
Close(tofile);
Close(fromfile);
}
//--------------------------------------------------------------------------//
+4 -7
View File
@@ -1,19 +1,18 @@
//--------------------------------------------------------------------------//
// 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 = NULL;
//--------------------------------------------------------------------------//
struct Library *TimezoneBase;
int main(const int argc, char *argv[])
{
@@ -51,5 +50,3 @@ int main(const int argc, char *argv[])
CloseLibrary(TimezoneBase);
return 0;
}
//--------------------------------------------------------------------------//
+3 -2
View File
@@ -2,9 +2,10 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
#ifndef TZFILE_H
#define TZFILE_H
//--------------------------------------------------------------------------//
/*
** This header is for use ONLY with the time conversion code.
** There is no guarantee that it will remain unchanged,
@@ -12,7 +13,7 @@
** Do NOT copy it to any system include directory.
** Thank you!
*/
//--------------------------------------------------------------------------//
/*
** Information about time zone files.
*/
+17 -18
View File
@@ -1,14 +1,14 @@
//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#ifndef TZ_VERSION_H
#define TZ_VERSION_H
//--------------------------------------------------------------------------//
#if defined(__amiga__) || defined(__AMIGA__) || defined(__amigaos4__) || \
defined(__morphos__) || defined(__MORPHOS__) || defined(__aros__) || \
defined(__AROS__) || defined(AOS3) || defined(AOS4) || defined(AROS) || \
defined(MORPHOS)
//--------------------------------------------------------------------------//
#ifndef __amiga__
# define __amiga__
#endif
@@ -32,7 +32,7 @@
# define AOS4
# endif
#endif
//--------------------------------------------------------------------------//
#if defined(AOS3)
# define HAVE_ADJTIME 0
# define HAVE_LINK 0
@@ -54,7 +54,7 @@
# define INITCLEAN 1
# define AVOID_TIMEOFDAY 1
#endif
//--------------------------------------------------------------------------//
#include <exec/io.h>
#include <exec/types.h>
#include <exec/memory.h>
@@ -75,10 +75,10 @@
#include <clib/intuition_protos.h>
#include <clib/battclock_protos.h>
#include <resources/battclock.h>
// --------------------------------------------------------------------------- //
#define OPEN_ERROR "Cannot open %s.\n"
#define OPEN_VER_ERROR "Cannot open %s (%ld.0)\n"
// --------------------------------------------------------------------------- //
#define INTUILIB_NAME "intuition.library"
#define INTUILIB_REV 37L
#define GADTOOLLIB_NAME "gadtools.library"
@@ -90,36 +90,35 @@
#define DOSLIB_NAME "dos.library"
#define DOSLIB_REV 37L
#define TIMEZONELIB_NAME "timezone.library"
#define TIMEZONELIB_REV 0L
#define TIMEZONELIB_REV 2L
#define TIMER_NAME TIMERNAME
#define BATTCLOCK_NAME BATTCLOCKNAME
#define PUBSCREEN_NAME "PubScreen"
#define ENVSIZE 128
#ifdef AOS3
# define REQ_ERROR "Requires Kickstart 2.04 (37.175) or later.\n"
# define IPTR APTR
#endif
#ifdef AROS
# define REQ_ERROR "Requires a newer version of AROS.\n"
# define _STDC_TIME_H_
# include <ctype.h>
#endif
//--------------------------------------------------------------------------//
#define VERSION_NO 1
#define VERSION "VERSION_NO"
#define REVISION_NO 03
#define REVISION "REVISION_NO"
#define DATE "25.07.2015"
#define XSTR(s) STR(s)
#define STR(s) #s
#define VERSION_NO 2
#define VERSION XSTR(VERSION_NO)
#define REVISION_NO 00
#define REVISION XSTR(REVISION_NO)
#define DATE "30.07.2015"
#define PACKAGE_TZ "tzcode"
#define VERSION_TZ "2015e"
#define BUGEMAIL_TZ "carsten.larsen@mail.com"
#define AMIGA_VERSION " " VERSION "." REVISION " (" DATE ") " \
PACKAGE_TZ " " VERSION_TZ
//--------------------------------------------------------------------------//
static char const PKGVERSION[] = "(" PACKAGE_TZ ")";
static char const TZVERSION[] = VERSION_TZ;
static char const REPORT_BUGS_TO[] = BUGEMAIL_TZ;
//--------------------------------------------------------------------------//
#endif
//--------------------------------------------------------------------------//
#endif
+570 -517
View File
File diff suppressed because it is too large Load Diff
+26 -24
View File
@@ -2,24 +2,25 @@
// 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"
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
//--------------------------------------------------------------------------//
const char *vers = "\0$VER: ZDump" AMIGA_VERSION;
//--------------------------------------------------------------------------//
struct Library *DOSBase = NULL;
struct Library *TimezoneBase = NULL;
struct Library* LocaleBase = NULL;
struct Locale* locale = NULL;
//--------------------------------------------------------------------------//
struct Library *LocaleBase = NULL;
struct Locale *locale = NULL;
struct RDArgs *rdargs = NULL;
// Substitutes for pre-C99 compilers.
#ifndef HAVE_STDINT_H
# define HAVE_STDINT_H \
@@ -87,7 +88,7 @@ typedef long intmax_t;
#else
# include <stdbool.h>
#endif
//--------------------------------------------------------------------------//
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif /* !defined EXIT_SUCCESS */
@@ -148,15 +149,15 @@ typedef long intmax_t;
** occur on any practical platform.
*/
enum { SECSPER400YEARS_FITS = SECSPERLYEAR <= INTMAX_MAX / 400 };
//--------------------------------------------------------------------------//
#if 2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)
# define ATTRIBUTE_PURE __attribute__ ((__pure__))
#else
# define ATTRIBUTE_PURE /* empty */
#endif
//--------------------------------------------------------------------------//
#define _(msgid) msgid
//--------------------------------------------------------------------------//
/* The minimum and maximum finite time values. */
enum { atime_shift = CHAR_BIT * sizeof (time_t) - 2 };
time_t const absolute_min_time =
@@ -171,7 +172,7 @@ time_t const absolute_max_time =
int longest;
bool warned;
bool errout;
//--------------------------------------------------------------------------//
#define isalpha(c) IsAlpha(locale, (ULONG)c)
long long int strtoll(const char *nptr, char **endptr, int base);
char const *abbr(struct tm const *);
@@ -181,7 +182,7 @@ time_t hunt(timezone_t, char *, time_t, time_t);
void show(timezone_t, char *, time_t, bool);
const char *tformat(void);
time_t yeartot(intmax_t) ATTRIBUTE_PURE;
//--------------------------------------------------------------------------//
// Return A + B, exiting if the result would overflow.
size_t sumsize(size_t a, size_t b)
{
@@ -233,7 +234,7 @@ char const *saveabbr(char **buf, size_t *bufalloc, struct tm const *tmp)
char const *ab = abbr(tmp);
return ab;
}
//--------------------------------------------------------------------------//
#define ARGSFORMAT "VERBOSE/S,VERBOSE2/S,C=CUTOFF/K,T=CUTOFFVERBOSE/K,ZONENAMES/M"
int amiga_open_libs();
@@ -253,7 +254,6 @@ int main(int argc, char *argv[])
struct tm tm;
struct tm newtm;
struct tm *newtmp;
struct RDArgs *rdargs;
char *abbrev = NULL;
size_t abbrevsize = 0;
int i = 0;
@@ -410,10 +410,7 @@ int main(int argc, char *argv[])
tzfree(tz);
}
if (errout && (ferror(stderr) || fclose(stderr) != 0))
return EXIT_FAILURE;
return EXIT_SUCCESS;
return errout ? EXIT_FAILURE : EXIT_SUCCESS;
}
//--------------------------------------------------------------------------//
time_t yeartot(const intmax_t y)
@@ -652,30 +649,32 @@ void dumptime(const struct tm *timeptr)
printf("%d%d", lead, ((trail < 0) ? -trail : trail));
}
}
//--------------------------------------------------------------------------//
void amiga_open_lib_error(char *name, int version)
{
FPrintf(Output(), (STRPTR)OPEN_VER_ERROR, name, version);
FPrintf(Output(), (STRPTR)REQ_ERROR, NULL);
}
int amiga_open_libs()
{
atexit(amiga_close_libs);
if(!(DOSBase = OpenLibrary((STRPTR)DOSLIB_NAME, DOSLIB_REV))) {
DOSBase = OpenLibrary((STRPTR)DOSLIB_NAME, DOSLIB_REV);
if(!DOSBase) {
amiga_open_lib_error(DOSLIB_NAME, DOSLIB_REV);
return 5;
}
if(!(LocaleBase = OpenLibrary((STRPTR)LOCALELIB_NAME, LOCALELIB_REV))) {
LocaleBase = OpenLibrary((STRPTR)LOCALELIB_NAME, LOCALELIB_REV);
if(!LocaleBase) {
amiga_open_lib_error(LOCALELIB_NAME, LOCALELIB_REV);
return 5;
}
locale = OpenLocale(NULL);
if(!(TimezoneBase = OpenLibrary((CONST_STRPTR)TIMEZONELIB_NAME, TIMEZONELIB_REV))) {
TimezoneBase = OpenLibrary((CONST_STRPTR)TIMEZONELIB_NAME, TIMEZONELIB_REV);
if(!TimezoneBase) {
amiga_open_lib_error(TIMEZONELIB_NAME, TIMEZONELIB_REV);
return 5;
}
@@ -685,6 +684,10 @@ int amiga_open_libs()
void amiga_close_libs()
{
if(rdargs) {
FreeArgs(rdargs);
}
if (TimezoneBase != NULL) {
CloseLibrary(TimezoneBase);
TimezoneBase = NULL;
@@ -705,4 +708,3 @@ void amiga_close_libs()
DOSBase = NULL;
}
}
//--------------------------------------------------------------------------//
+2 -4
View File
@@ -2,17 +2,15 @@
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
// NOTICE: This version does not yet work on Classic Amiga Hardware.
// The code ends up in an infinitive loop in the infile function.
//--------------------------------------------------------------------------//
#include "amiga_tz.h"
#include "private.h"
#include "tzversion.h"
//--------------------------------------------------------------------------//
#include "locale.h"
#include "tzfile.h"
#include <stdarg.h>
#define ZIC_VERSION_PRE_2013 '2'

Some files were not shown because too many files have changed in this diff Show More