Commit Graph

201 Commits

Author SHA1 Message Date
drochner
fb535ac77e Make mktime(3) work with 64-bit time_t.
The problem is that the tm_year field of "struct tm" is just an "int"
(per POSIX), and thus time_t values >  2^31*60*60*24*365 cannot
be converted. This made mktime(3) fail even if no such large time values
were passed in by user code because the algorithm does a binary search
over the time_t range which fails if a probe value cannot be converted.
To fix this, limit the time_t range to be scanned to 55 bits (which
is a bit on the safe side, but still good until y570855533).
This is more a stopgap fix, the overflow should be checked for
at other places as well (eg localtime(3)), and there are some more
limitations in timezone parsing code.
2009-01-18 10:57:15 +00:00
christos
461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
christos
9f012c8aed don't forget to use neg. 2008-11-04 21:08:33 +00:00
christos
2844d6eadc we don't need * 2008-11-04 20:17:56 +00:00
christos
b4be570207 Our new syslogd seems to want to depend on %z which is a gnu extension.
- While here, add all the rest of gnu extensions: %g, %G, %u.
- Fix long standing bug where %Z would not work because "private.h" was
  not included. (Hi Brian!)
2008-11-04 18:37:28 +00:00
christos
40d362f8e0 malloc(3) and getenv(3) affect errno; make sure we save and restore it
Reported by Andy Shevchenko
2008-08-27 08:49:03 +00:00
dholland
d617ea4585 Fix handling of legacy global variable timezone outputs. PR misc/22221. 2008-05-25 06:18:06 +00:00
martin
11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ginsbach
b876d7a7df Add %F the ISO 8601 date format which is equivalent to %Y-%m-%d. This
format character is supported for reasons of symmetry with strftime(3).
FreeBSD and GNU versions of strptime(3) both support %F.
2008-04-25 20:51:10 +00:00
ginsbach
52de4d6274 Change date for previous change (addition of %Z). 2008-04-25 14:37:00 +00:00
ginsbach
43e9d46aab Add support for %Z ala FreeBSD and some other strptime(3) implementations.
Reviewed by christos.
2008-04-24 21:34:48 +00:00
ginsbach
f5f9bb5739 Make sure that %r honors the LC_TIME t_fmt_ampm. This restores
functionality lost at revision 1.12!
2007-07-31 20:19:16 +00:00
kleink
b290748021 Restore i18n wrapping removed in previous. 2006-12-04 17:24:40 +00:00
christos
1d83cc5b6c nuke perror. 2006-11-03 20:21:16 +00:00
perry
35a6eb4807 Make the declarations of wday_name and mon_name less eccentric. I
suppose they were legal before, but lint was unhappy about them. It
was probably unhappy for the wrong reasons, but I think it certainly
wasn't something one would want anyway. Declaring a string of length
three to have storage of length three without room for the nul is
asking for trouble even if it does work in context, and there was no
reason not to state how many days there are in a week or months in a
year -- they aren't onerous and aren't going to change.

NOTE: If this code isn't being synced with the central TZCODE stuff,
it probably should be KNFed etc. It is full of K&R declarations,
register, lots of eccentricities, etc.
2006-10-15 15:32:42 +00:00
reed
5fe28dc7e5 Fix typo or mispelling. 2006-06-17 04:58:14 +00:00
christos
1324bf1ab1 Remove a variable that became set-and-not-used after the dead code removal. 2006-03-22 14:01:30 +00:00
christos
e5d3e31596 Coverity CID 578: remove dead code 2006-03-22 00:14:18 +00:00
christos
ee43724903 Coverity CID 580: fix 'c' handling to match 'x' ('c' used the wrong variable) 2006-03-22 00:11:28 +00:00
christos
03256c6e55 WARNS=4 2005-11-29 03:11:58 +00:00
christos
5b84b3983f compat core reorg. 2005-09-13 01:44:08 +00:00
christos
86741d79ab - Fix the remaining indr_references so that they define lint symbols.
- Add an internal symbol for strerror_r (thanks klaus for noticing)
- Remove internal __strerror
2005-07-30 15:21:20 +00:00
christos
ed7ae36357 Fix linted comments and use __UNCONST. 2005-07-16 19:48:09 +00:00
christos
aeec445c81 Use CPPFLAGS for -D flags otherwise lint does not get it. 2005-07-16 19:36:25 +00:00
lukem
88c3eadbfa Add missing __RCSID() 2005-06-12 05:21:25 +00:00
dsl
8476342d19 Some more optimisations - I must stop looking at this file!
Update copyright to include 2005
(I have a compleetly different version, but it is only a few 100 bytes
smaller due to a 560 byte data area.)
2005-03-05 14:07:15 +00:00
dsl
3fa8666b4f A going-over with the optimiser, save over 500 bytes.
I think this is enough to get rescue_tiny to fit again.
While there fix some bugs:
- %y failed to subtract 1900 from tm_year
- %p (am/pm) only worked at the end of the string
- %E% was treated at %% (ie match a % character)
regression test being added....
2005-03-04 21:41:42 +00:00
christos
13c63648cb PR/28324: Takayoshi Kochi: localtime_r(3) returns GMT
Add missing tzset_unlocked(); as suggested.
2004-11-16 04:15:28 +00:00
kleink
8bd97363d6 Merge tzcode2004a. 2004-05-27 20:39:49 +00:00
kleink
0e5c1261b9 Update for tzcode2004a. 2004-05-27 20:33:31 +00:00
kleink
15a5f3876a Don't use tm_gmtoff for %z: a strictly conforming ISO C application won't
initialize it.  However, instead of using what is suggested in this code
path, attempt get it right for DST as well.  Addresses PR standards/21722
from Richard Earnshaw.
2004-05-12 23:03:11 +00:00
kleink
4c5383c22f Don't use tm_zone for %Z: a strictly conforming ISO C application won't
initialize it.  Addresses PR standards/21722 from Richard Earnshaw.
2004-05-11 09:32:02 +00:00
kleink
f52f2d3dfe Add a manual page for the standard-inspired offtime(3) and friends;
requested by Thomas Klausner.
2004-05-10 02:02:00 +00:00
kleink
84c861c7a5 Add documentation for %v. Noted by Havard Eidnes in PR bin/25180. 2004-04-14 21:59:39 +00:00
kleink
78a2369a15 Make casing in previous consistent. 2004-03-19 19:30:23 +00:00
kleink
ddfc3e5143 %% doesn't write anything; a literal % is matched. Noted by Hubert Feyrer. 2004-03-19 19:28:08 +00:00
kleink
a2c17b5c1e One merge-o missed in previous. 2003-12-20 00:21:00 +00:00
kleink
84a2a5ca6e Merge tzcode2003e. 2003-12-20 00:12:05 +00:00
kleink
b717391e1a Note: the previous revision was an update for tzcode2003_e_. 2003-12-19 23:52:44 +00:00
kleink
4a2741cba1 Update for tzcode2003d. 2003-12-19 22:25:42 +00:00
keihan
c9c20433ad Revert last change, as this is a 3rd-party file, noted by kleink@. 2003-12-05 06:56:19 +00:00
keihan
39d96c1f34 netbsd.org -> NetBSD.org
NetBSD.ORG -> NetBSD.org

Now src/lib is done.
2003-12-04 23:39:18 +00:00
kleink
26198324b4 Merge tzcode2003d. 2003-10-29 20:43:27 +00:00
kleink
dc2bc4a89d Import tzcode2003d. 2003-10-29 20:19:13 +00:00
lukem
171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
wiz
dca9ccd375 Use St -isoC-9X instead of St -isoC9X, to be in sync with groff. 2003-09-08 17:54:31 +00:00
jhawk
4b3391a2a6 %F is a date conversion, not a time converstion.
don't bother to bump Dd
2003-09-03 16:10:56 +00:00
agc
eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
wiz
23ea338b1b Use a better width argument. 2003-06-30 12:02:08 +00:00