1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2025-11-21 11:01:47 +00:00
Commit Graph

147 Commits

Author SHA1 Message Date
71b6c1b210 * zdump.c: Tune performance of -c with large numbers on 64-bit hosts.
On my platform (Ubuntu 13.04 x86-64, Xeon E3-1225 V2), this sped up
'zdump -V -c 2147483647,2147483648 America/Los_Angeles'
from 13.880 to 0.000 seconds user+system time.
(INTMAX_MAX): Define if the system doesn't.
(SECSPER400YEARS): New macro.
(SECSPER400YEARS_FITS): New constant.
(yeartot): Speed up by using division instead of
repeated subtraction.
2013-08-15 00:30:21 -07:00
3cfb933344 Remove attempt to support floating-point time_t.
It wasn't tested and probably never worked, no platform used it,
and the latest POSIX no longer allows it.
* Makefile (typecheck): Don't check time_t being 'double'.
* Theory: Document the change.
* difftime.c (difftime):
* localtime.c (differ_by_repeat, tzload, timesub, time2sub):
* private.h (time_t_min, time_t_max):
* zdump.c (absolute_min_time, absolute_max_time, tformat):
Don't try to support floating-point time_t.
* localtime.c, private.h, zdump.c: Don't include float.h.
* localtime.c (truncate_time, double_to_time):
* private.h (TYPE_INTEGRAL):
* zdump.c (checkabsolutes):
Remove; no longer needed.  All uses removed.
* zdump.8 (LIMITATIONS): Remove discussion of floating-point time_t.
2013-08-12 01:41:34 -07:00
f0133dd86a Port to NetBSD, where, e.g., 'time_t' is wider than 'long'.
I audited the code and fixed as many width-asssumptions as I could
find, including several places where the code assumed that 'time_t'
was no wider than 'long'; this assumption is not true on 32-bit
NetBSD platforms.  This caught every problem that is already fixed
in the NetBSD zic.c, and caught quite a few more.
* Makefile: Add comments re HAVE_DOS_FILE_NAMES and HAVE_INTTYPES_H.
* date.c (checkfinal, netsettime): Don't use 'long' where 'int' will do.
* difftime.c (difftime): Mark with ATTRIBUTE_CONST.
Use uintmax_t, not unsigned long, for the widest unsigned integer type.
Use long double, not double, if time_t is wider than uintmax_t;
this can in theory help on nonstandard platforms, such as GCC
with 64-bit uintmax_t and 128-bit __int128_t.
* localtime.c (struct ttinfo.tt_gmtoff, struct rule.r_time)
(detzcode, getsecs, getoffset, gmtsub, localsub, increment_overflow32)
(normalize_overflow32, time1, time2, timesub, transtime, tzparse)
(time2sub, timeoff, gtime):
* tzfile.h (SECSPERDAY):
* zdump.c (SECSPERDAY):
* zic.c (convert, puttzcode):
Use int_fast32_t, not long, when all we care is that values up to
2**31 can be stored.  This doesn't fix any bugs, but it allows
more opportunity for compiler optimization.
(struct lsinfo.ls_corr, timesub, leapcorr):
Use int_fast64_t, not long, when values up to 2**63 can be stored.
(timesub): Make it clearer when we are truncating 0.5 to 0.
(increment_overflow32): Rename from long_increment_overflow.
All uses changed.
(normalize_overflow32): Rename from long_normalize_overflow.
All uses changed.
* private.h (HAVE_INTTYPES_H, ATTRIBUTE_CONST): New macros.
Include <inttypes.h> if HAVE_INTTYPES_H.
(INT_FAST64_MIN, INT_FAST64_MAX, SCNdFAST64, int_fast32_t, PRIdMAX)
(uintmax_t, PRIuMAX, _Noreturn):
Define to reasonable values if it's an older compiler.
* scheck.c (scheck): Add support for arbitrary formats, such as
those that SCNdFAST64 can expand to, at the price of no longer
supporting weird conversion specs like "%[%]".
* strftime.c (_fmt): Use intmax_t and uintmax_t to format time_t,
not long and unsigned long.
* zdump.c (int_fast32_t, intmax_t, PRIdMAX, SCNdMAX):
Define for pre-C99 compilers, like private.h does.
(delta, yeartot, main): Use intmax_t, not long.
(hunt): Use time_t, not long, since the diff must be nonnegative.
(tformat): Allow for time_t wider than long.
* zic.c (ZIC_MIN, ZIC_MAX, SCNdZIC): New macros.
(OFFSET_STRLEN_MAXIMUM, RULE_STRLEN_MAXIMUM): Remove.
(struct rule): Make r_loyear, r_hiyear, r_tod, r_stdoff, z_gmtoff,
z_stdoff zic_t, not long.
(addtype, gethms, oadd, rpytime, tadd, gmtoffs, corr, inleap)
(stringoffset, stringrule, outzone, addtype, adjleap, rpytime)
(LDAYSPERWEEK):
Use zic_t, not long.
(leapminyear, leapmaxyear, min_year, max_year, rulesub, updateminmax)
(outzone, rpytime):
Use zic_t, not int.
(usage): Now _Noreturn.
(main): Use S_IWGRP, not 'unix', to determine whether to call umask.
(writezone): Omit unnecessary cast.
(mkdirs): Use HAVE_DOS_FILE_NAMES, not 'unix', to determine
whether to parse DOS file anmes.
(eitol): Remove; no longer needed.
2013-05-27 21:26:18 -07:00
8a883a64cb Add support for testing time_t types other than the system's.
This makes it easier to test on (say) Debian, even if we're
testing the time_t type on (say) NetBSD.  NetBSD uses 64-bit
time_t on 32-bit hosts, and this lets us test a NetBSD-style
implementation (32-bit 'long', 64-bit time_t) on a 32-bit Debian host.
* Makefile: Update comments to talk about TIME_T_FLOATING and time_tz.
Sort the comments.
* private.h (restrict): Define to empty with older compilers.
'restrict' is now needed, to define gmtime_r and localtime_r in
standard ways when time_tz is defined.
Make the following changes if time_tz is defined:
(sys_time, time): New static functions.  The former is the system
'time' function that applies to the system time_t, the latter
our function that applies to our time_t.
(time_t, ctime, ctime_r, difftime, gmtime, gmtime_r, localtime)
(localtime_r, mktime): Rename to tz_time_t, tz_ctime, etc.,
via macros.  Declare the renamed versions.
* zdump.8: Document new options -V, -t.
* zdump.c: Include private.h if time_tz is defined.
(INITIALIZE): Remove; no longer needed.
(absolute_min_time, absolute_max_time): Work even if time_t
is wider than intmax_t, which can be true with GCC and __int128_t.
Use the new TIME_T_FLOATING macro for this.
(usage): Document new flags.
(main): Support them.
2013-05-27 14:59:09 -07:00
a435f9f0ec Make bug-reporting address more configurable.
Based on a patch by Joseph S. Myers in
<http://mm.icann.org/pipermail/tz/2012-November/018452.html>.
* Makefile (BUGEMAIL): New macro.
(version.h, tzselect): Use it to define REPORT_BUGS_TO.
* tzselect.ksh (REPORT_BUGS_TO): New variable, used for --help.
* zdump.c, zic.c (usage): Use REPORT_BUGS_TO for --help.
2012-11-12 21:52:35 -08:00
89a60086d3 Output version info in a more-typical format.
E.g., "zic (tzcode) 2012i" instead of "tzcode2012i".
Thread started by Joseph S. Myers in
<http://mm.icann.org/pipermail/tz/2012-November/018439.html>.
* Makefile (PACKAGE): New macro.
(version.h, tzselect): New constant PKGVERSION, derived from PACKAGE.
(tzselect): TZVERSION is now simply VERSION, since PACKAGE is also
output.
* tzselect.ksh (PKGVERSION): New var, which Makefile substitutes for.
(--usage, --version): Exit with nonzero status if we can't
output the help or version number.
* tzselect.ksh (--version):
* zdump.c, zic.c (main):
Output versions like this: "zdump (tzcode) 2012i".
2012-11-09 18:12:22 -08:00
bd6e304281 Change email address to tz@iana.org.
* africa, australasia, europe, northamerica, southamerica:
* tzselect.ksh, zdump.c, zic.c:
In commentary and strings, change email address from
tz@elsie.nci.nih.gov to tz@iana.org, as the old email address
no longer works.
2012-11-09 17:49:36 -08:00
2151ca6b20 Restore 'register'.
* asctime.c (asctime_r, asctime):
* date.c (main, dogmt, reset, nondigit, sametm, convert, checkfinal):
* ialloc.c (icatalloc):
* localtime.c (detzcode, detzcode64, settzname, tzload)
(typesequiv, getzname, getqzname, getnum, getsecs, getoffset)
(getrule, transtime, tzparse, tzset, localsub, gmtsub)
(leaps_thru_end_of, timesub, increment_overflow)
(long_increment_overflow, normalize_overflow)
(long_normalize_overflow, tmcomp, time2sub, time1, leapcorr):
* scheck.c (scheck):
* strftime.c (_yconv):
* zdump.c (my_localtime, abbrok, main, yeartot, hunt)
(delta, show, abbr, dumptime):
* zic.c (main, dolink, itsdir, associate, infile, inrule)
(inzone, inzcont, inzsub, inleap, inlink, rulesub, convert64)
(writezone, doabbr, stringoffset, stringrule, stringzone)
(outzone, addtype, leapadd, adjleap, ciequal, itsabbr, byword)
(getfields, rpytime, newabbr, mkdirs):
Restore the uses of 'register', reverting that part of the
"More C modernization" patch.  See Arthur David Olson in
<http://mm.icann.org/pipermail/tz/2012-October/018385.html>.
2012-10-26 17:37:42 -07:00
c350bfd55f More C modernization.
* Makefile (typecheck): Add -D__time_t_defined to CFLAGS,
for glibc 2.15.
* asctime.c (asctime_r, asctime):
* date.c (main, dogmt, reset, nondigit, sametm, convert, checkfinal):
* ialloc.c (icatalloc):
* localtime.c (detzcode, detzcode64, settzname, tzload)
(typesequiv, getzname, getqzname, getnum, getsecs, getoffset)
(getrule, transtime, tzparse, tzset, localsub, gmtsub)
(leaps_thru_end_of, timesub, increment_overflow)
(long_increment_overflow, normalize_overflow)
(long_normalize_overflow, tmcomp, time2sub, time1, leapcorr):
* scheck.c (scheck):
* strftime.c (_yconv):
* zdump.c (my_localtime, abbrok, main, yeartot, hunt)
(delta, show, abbr, dumptime):
* zic.c (main, dolink, itsdir, associate, infile, inrule)
(inzone, inzcont, inzsub, inleap, inlink, rulesub, convert64)
(writezone, doabbr, stringoffset, stringrule, stringzone)
(outzone, addtype, leapadd, adjleap, ciequal, itsabbr, byword)
(getfields, rpytime, newabbr, mkdirs):
Omit 'register', as it adds no value these days.  See Christos Zoulas in
<http://mm.icann.org/pipermail/tz/2012-October/018376.html>.
* date.c (netsettime) [TSP_SETDATE]: Add forward decl.
Don't rely on implicit int.  Now static.  Use NULL, not 0.
* zdump.c: Include "limits.h".
(absolute_min_time, absolute_max_time): Compute at compile-time,
as the run-time tests relied on undefined behavior.
(checkabsolutes): Rename from setabsolutes.  Just check, since
there's nothing to set now.  All uses changed.
2012-10-26 00:48:01 -07:00
400ecf36bb Assume C89.
* Makefile (GCC_DEBUG_FLAGS): Modernize for GCC 4.6.3 x86.
* asctime.c (asctime_r, asctime):
* date.c (main, dogmt, reset, wildinput, nondigit, oops, display)
(timeout, sametm, netsettime):
* difftime.c (difftime):
* ialloc.c (icatalloc, icpyalloc):
* localtime.c (detzcode, detzcode64, differ_by_repeat)
(tzload, typesequiv, getzname, getnum, getsecs, getoffset)
(getrule, transtime, tzparse, gmtload, tzsetwall, tzset)
(localsub, localtime, localtime_r, gmtsub, gmtime, gmtime_r)
(offtime, leaps_thru_end_of, timesub, ctime, ctime_r)
(increment_overflow, long_increment_overflow)
(normalize_overflow, long_normalize_overflow, tmcomp, time2sub)
(time2, time1, mktime, timelocal, timegm, timeoff, gtime)
(leapcorr, time2posix, posix2time):
* scheck.c (scheck):
* strftime.c (strftime, _fmt, _conv, _add, _yconv, _loc):
* zdump.c (my_localtime, abbrok, usage, main, yeartot)
(delta, abbr, dumptime):
* zic.c (memcheck, eats, eat, error, warning, main)
(dolink, itsdir, rcomp, associate, infile, gethms, inrule)
(inzone, inzcont, inzsub, inleap, inlink, rulesub, convert)
(convert64, puttzcode, puttzcode64, atcomp, is32, writezone, DO)
(doabbr, updateminmax, stringoffset, stringrule, stringzone)
(outzone, addtt, addtype, leapadd, yearistype, lowerit, ciequal)
(itsabbr, byword, getfields, oadd, tadd, rpytime, newabbr)
(mkdirs, eitol):
Assume C89 or better.  Mostly this consists of using function
prototypes.  In a few places, prototypes are required for
portability to hosts where time_t does not promote to itself and
where a preceding prototype does not override a definition.  But
while we're at it we might as well be consistent: it's safe to
assume at-least-C89 these days.
* ialloc.c (nonzero, imalloc, icalloc, irealloc, ifree, icfree):
Remove; no longer needed now that we assume C89 or better.
All callers changed to use malloc, calloc, realloc, free.
* localtime.c (getzname, getqzname, leaps_thru_end_of, transtime):
* zdump.c (delta, yeartot):
* zic.c (eitol):
Now pure.
* private.h, zdump.c (ATTRIBUTE_PURE): New macro.
* private.h (icalloc, imalloc, irealloc, icfree, ifree): Remove decls.
* zic.c: Remove no-longer-necessary forward decls.
(max_time, min_time): Now const.
(setboundaries): Remove.
2012-10-12 07:53:12 -07:00
33232258ad Use a single version number for both code and data.
* Makefile (VERSION): New macro, superseding ...
(TZCODE_VERSION, TZDATA_VERSION): Remove.  All uses changed.
(version.h): Call the variable TZVERSION, not TZCODE_VERSION.
All uses changed.
(tzselect): Interpolate TZVERSION, not TZCODE_VERSION.
(public): Adjust to new versioning scheme.
* tzselect.ksh (TZVERSION): Rename from TZCODE_VERSION.
* zdump.c, zic.c (main): Use TZVERSION, not TZCODE_VERSION.
2012-07-25 07:46:06 -07:00
dccd5a16af Switch from SCCS to git.
Remove the SCCS keyword '%W%' from all files.
Mostly this just remove comments.
Remove trailing white space, too.
* Makefile (TZCODE_VERSION): New macro.
(version.h): New rule.
(tzselect): Interpolate TZCODE_VERSION.
(clean): Remove version.h.
(zdump.o, zic.o): Depend on version.h.
* asctime.c, date.c, difftime.c, ialloc.c, localtime.c, scheck.c:
* strftime.c, zdump.c, zic.c: Remove elsieid.
* private.h: Remove privatehid.
* tzfile.h: Remove tzfilehid.
* tzselect.h (TZCODE_VERSION): Rename from VERSION.
* zdump.c, zic.c: Include "version.h",
and use TZCODE_VERSION instead of elsieid.
2012-07-18 17:30:38 -07:00
9141e8082d usage function cleanup
SCCS-file: zdump.c
SCCS-SID: 8.10
2012-07-18 03:03:08 -04:00
7ebd2299ce public domain
SCCS-file: zdump.c
SCCS-SID: 8.9
2012-07-18 03:03:06 -04:00
f7dbf27930 looping fix
SCCS-file: zdump.c
SCCS-SID: 8.8
2012-07-18 03:03:06 -04:00
b5f59735d4 --help and --version work
SCCS-file: zdump.c
SCCS-SID: 8.7
2012-07-18 03:03:06 -04:00
cbd7d91c4b noncontroversial changes
SCCS-file: zdump.c
SCCS-SID: 8.6
2012-07-18 03:03:03 -04:00
7e960c058b P macro goes
SCCS-file: zdump.c
SCCS-SID: 8.5
2012-07-18 03:03:02 -04:00
16dfe23eb5 trailing white space eliminated
SCCS-file: zdump.c
SCCS-SID: 8.4
2012-07-18 03:03:01 -04:00
2da5fe077d match GNU output
SCCS-file: zdump.c
SCCS-SID: 8.3
2012-07-18 03:03:00 -04:00
5113240d10 STDC elimination
SCCS-file: zdump.c
SCCS-SID: 8.2
2012-07-18 03:02:57 -04:00
9bce6c15c3 White-suggested STDC mods
SCCS-file: zdump.c
SCCS-SID: 7.77
2012-07-18 03:02:52 -04:00
77ad572618 Eggert overflow mods
SCCS-file: zdump.c
SCCS-SID: 7.76
2012-07-18 03:02:52 -04:00
0e7c00bbb4 Eggert STDC mods
SCCS-file: zdump.c
SCCS-SID: 7.75
2012-07-18 03:02:52 -04:00
55d39f8727 deconsolidate gettext calls
SCCS-file: zdump.c
SCCS-SID: 7.74
2012-07-18 03:02:52 -04:00
13e59d0602 abbrok work
SCCS-file: zdump.c
SCCS-SID: 7.73
2012-07-18 03:02:52 -04:00
53743418c5 eliminate cast of exit result
SCCS-file: zdump.c
SCCS-SID: 7.72
2012-07-18 03:02:51 -04:00
b2187b0528 isascii et al fixes
SCCS-file: zdump.c
SCCS-SID: 7.71
2012-07-18 03:02:50 -04:00
3c0deed430 eliminated disputed changes for now
SCCS-file: zdump.c
SCCS-SID: 7.70
2012-07-18 03:02:50 -04:00
87e8df82fa delinted; mail address removed
SCCS-file: zdump.c
SCCS-SID: 7.69
2012-07-18 03:02:50 -04:00
604af544f1 delinted
SCCS-file: zdump.c
SCCS-SID: 7.68
2012-07-18 03:02:50 -04:00
74c580763e internationalization
SCCS-file: zdump.c
SCCS-SID: 7.67
2012-07-18 03:02:50 -04:00
2d111bbfa3 zap unused variable
SCCS-file: zdump.c
SCCS-SID: 7.66
2012-07-18 03:02:50 -04:00
dd74e1e30f time zone abbreviation warnings
SCCS-file: zdump.c
SCCS-SID: 7.65
2012-07-18 03:02:48 -04:00
a002aa526d 64-bit work
SCCS-file: zdump.c
SCCS-SID: 7.64
2012-07-18 03:02:48 -04:00
70e8ff874c LC_MESSAGES -> LC_ALL
SCCS-file: zdump.c
SCCS-SID: 7.63
2012-07-18 03:02:47 -04:00
c7a44f5ae7 delinted
SCCS-file: zdump.c
SCCS-SID: 7.62
2012-07-18 03:02:47 -04:00
7027447c35 warning elimination
SCCS-file: zdump.c
SCCS-SID: 7.61
2012-07-18 03:02:46 -04:00
9505b0cecb more typecheck work
SCCS-file: zdump.c
SCCS-SID: 7.60
2012-07-18 03:02:46 -04:00
f9f1feea3b SCCS-file: zdump.c
SCCS-SID: 7.59
2012-07-18 03:02:46 -04:00
5f82554c8a better output for outre time_t cases
SCCS-file: zdump.c
SCCS-SID: 7.58
2012-07-18 03:02:46 -04:00
e7913f496a more time_t type work
SCCS-file: zdump.c
SCCS-SID: 7.57
2012-07-18 03:02:46 -04:00
70a18e14ac some time_t progress
SCCS-file: zdump.c
SCCS-SID: 7.56
2012-07-18 03:02:45 -04:00
6067fdfa17 avoid << on time_t
SCCS-file: zdump.c
SCCS-SID: 7.55
2012-07-18 03:02:45 -04:00
9013820ce1 exit strategy
SCCS-file: zdump.c
SCCS-SID: 7.54
2012-07-18 03:02:45 -04:00
9a3353767c SCCS-file: zdump.c
SCCS-SID: 7.53
2012-07-18 03:02:45 -04:00
8c8c034d47 SCCS-file: zdump.c
SCCS-SID: 7.52
2012-07-18 03:02:45 -04:00
70b5d0e8f1 floating work
SCCS-file: zdump.c
SCCS-SID: 7.51
2012-07-18 03:02:45 -04:00
9f0ba95e40 eliminate double spacing
SCCS-file: zdump.c
SCCS-SID: 7.50
2012-07-18 03:02:45 -04:00
45e9478454 more year work
SCCS-file: zdump.c
SCCS-SID: 7.49
2012-07-18 03:02:45 -04:00