Commit Graph

379 Commits

Author SHA1 Message Date
martin
f5962309a9 Add a few casts to avoid (IMHO bogus) gcc warnings breaking the vax build. 2012-10-25 13:14:32 +00:00
christos
0b25fef287 remove error(1) output. 2012-10-24 00:30:52 +00:00
christos
fb0d3fd558 apply 2012g via patch 2012-10-24 00:10:03 +00:00
christos
b6be6961a7 merge 2012e 2012-08-09 12:38:25 +00:00
abs
9e66e6d75e Update old-style definitions to ANSI, remove a couple of register
definitions along the way. Fixed gcc 4.1 build (thank you vax)
2012-06-25 22:32:43 +00:00
wiz
5eee512564 Fix typo, from Bug Hunting. 2012-04-06 11:35:39 +00:00
matt
44551472c9 Remove use of __P
Switch to using C89 definitions.
2012-03-20 16:38:44 +00:00
christos
c5e820cae4 PR/45989: Martin Husemann: lint invocation does include -w only on i386
- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
  would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
  builds)

approved by core@
2012-03-13 21:13:30 +00:00
shattered
aaf49ded47 Xref zdump(8). OK by wiz@ 2012-02-25 10:56:52 +00:00
martin
f989e55d57 Do not force errno to EOVERFLOW when returning -1 from mktime or friends.
First, there are legitimate cases where we want to return -1 and errno == 0,
second, all paths go through time1() and/or time2sub() which explicitly
take care to set errno in cases of real overflows.
Should fix atf test failure on various ports in
lib/libc/time/t_mktime:timegm_epoch.
2012-01-07 15:19:35 +00:00
christos
788c275de8 Change the way that we compute the time when we fall in the dst gap: instead
of supplying just the high bound and thus losing minutes and seconds, add
the DST offset to the struct tm (since we know we are going to move ahead
since we fell in the gap), and try again.
2011-11-08 18:37:31 +00:00
christos
0d371217b3 no need to adjust the off, hi is already at the right time. 2011-11-07 19:42:03 +00:00
christos
672226e183 document where tm_zone comes from in the _z calls. 2011-11-02 23:06:08 +00:00
apb
6a9c6d1ff5 Use double quotes to prevent multiple adjacent spaces from
being squashed to a single space on output.
2011-11-02 19:59:40 +00:00
christos
b94db0ddf1 Only advance the time if we are skipping the gap. 2011-10-28 21:51:06 +00:00
christos
31b34eee08 prevent underflow from giving us a false positive test in the first iteration. 2011-10-28 13:53:06 +00:00
christos
1299a7651f Change mktime*(3) so that it does not always return EOVERFLOW when it cannot
perform the conversion, but returns EINVAL when the time requested would fall
in the DST gap, or is not representable in the timezone requested, and document
this.
2011-10-27 14:47:59 +00:00
christos
22bfd2bd63 Add code (not enabled) that allows mktime() to return a value for times
in the DST gap when tm_isdst == -1, like glibc does. Document both behaviors.
2011-10-16 17:59:32 +00:00
joerg
67f518f496 Use __dead 2011-09-16 16:05:58 +00:00
christos
040ffb7f4c forgot to change one usage call. 2011-09-04 13:25:22 +00:00
christos
a61b0b2ed7 bring in the 2011i changes. 2011-09-04 10:10:26 +00:00
christos
14e36cd2fb remove unneeded casts 2011-08-24 07:51:31 +00:00
christos
0087958f8b do the overflow check in a way that gcc-4.5 likes. 2011-08-16 07:51:46 +00:00
christos
a9157d7432 annotate that some functions use non-literal format strings. 2011-08-14 09:07:37 +00:00
plunky
14f0284e32 don't indent this bullet list either, it is not required
(the text is indented anyway)
2011-07-09 09:12:11 +00:00
christos
548c989a0b don't modify tzname unless we are the non-reentrant version. 2011-06-16 22:40:17 +00:00
njoly
7acc235b8f Do not indent RETURN VALUES section (which was ignored because of
missing dash).
2011-06-09 12:13:00 +00:00
jruoho
ff8dfca355 Xref tm(3). 2011-04-14 05:50:49 +00:00
jruoho
e615e396bd Split out FUNCTIONS to make this tolerable to read. Also improve readability
with lists. Describe the functions in the order of appearance in SYNOPSIS.
Use CAVEATS instead of NOTES. Remove "man page spam". Etc.
2011-04-12 13:46:38 +00:00
jruoho
72e27957d4 Xref tm(3). 2011-04-12 08:40:34 +00:00
jruoho
47a900e8bc Move some of the discussion from the messy ctime(3) to tm(3). 2011-04-12 08:39:26 +00:00
jruoho
8ee666bc1f .Dv NULL. 2011-04-12 05:41:22 +00:00
christos
10e6f9749d remove duplicate weak aliases 2011-02-21 22:07:44 +00:00
christos
26104203c2 Don't forget to set errno. Pointed out by yamt. 2011-02-13 23:58:40 +00:00
njoly
7ef8fa728e Redo Vt macro fixes (from r1.35) which were lost. 2011-01-24 19:37:35 +00:00
christos
b163cf8017 Fix reversed oveflow check. 2011-01-15 15:42:10 +00:00
martin
cca650856d Backout previous, it breaks the build big time and causes e.g. date(1)
and top(1) to dump core.
2011-01-15 12:31:56 +00:00
christos
dd5b7b1566 don't depend on integer oveflow wrapping to detect it. From Paul Eggert in
the tz mailing list.
2011-01-14 23:35:07 +00:00
christos
221dcf2e47 Since localsub and gmtsub are called recursively to search for the local
time, setting EOVERFLOW at the inmost level will unfortunately persist,
even if later calls to those functions succeed. Move the EOVERFLOW setting
to the top level calls.
2011-01-06 02:41:34 +00:00
christos
3a693ad8ca PR/44248: Antti Kantee: Fix multi-threaded localtime hang. 2010-12-17 23:11:57 +00:00
wiz
db9d3e0efd Sort ERRORS. Fix a typo. Readd macro usage lost in previous.
Remove trailing whitespace.
2010-12-17 01:30:50 +00:00
wiz
a5f2300ef5 Sort SEE ALSO, add a serial comma. 2010-12-17 01:30:14 +00:00
wiz
72b0a97144 Use more markup. 2010-12-17 01:29:45 +00:00
christos
d6bc393ba9 it is getname not time. 2010-12-16 22:18:37 +00:00
christos
84df4ad5ec add the 3 missing man pages. 2010-12-16 21:53:56 +00:00
christos
5a87b22ec6 Provide a re-entrant and thread-safe set of timezone API's that
don't require locking and can operate on user-specified timezones
as opposed to having to alter the environment to change a timezone.
This work was presented to the tzcode folks and it was generally
accepted, but there seems to be a lot of inertia.
2010-12-16 18:36:47 +00:00
njoly
5db815a78e Convert a few macros to Vt (variable type). 2010-12-09 09:22:31 +00:00
wiz
51a05c8628 Fix a typo and remove trailing whitespace. 2010-10-27 19:18:00 +00:00
christos
de19ef9132 markup improvements, document ctype_r, time_t is not a "long integer" 2010-10-27 19:16:04 +00:00
wiz
82776533ea New sentence, new line. 2010-05-30 07:57:08 +00:00
dholland
2264536172 Note briefly how to avoid the problem where 0 can be a valid successful
return as well as an error. Suggested by Robert Elz in follow up to PR 39392.
2010-05-29 20:32:18 +00:00
pgoyette
c795d9ed89 Remove repeated text "After filling..."
XXX Someone else can decide whether we should refer to "U.S.A." or to
XXX "the United States" in the parenthetical.
2010-05-15 13:54:52 +00:00
jruoho
61564b38a1 Note the ambiguity of the return value in the BUGS section.
From Christian Biere <christianbiere@gmx.de> in PR #39392.
2010-04-29 10:03:12 +00:00
drochner
ebfe3c0a28 remove some stray __weak_aliases, where the target functions were
__RENAMEd due to the time_t/dev_t type changes, which caused bogus
references to compat functions
now a libc built with BUILDCOLD is usable
2010-03-23 20:28:58 +00:00
christos
48bf0eec29 Fix a bug reported by Gene, and debugged by Robert Elz. fsck_ffs can coredump
if the timezone file fails to load, due to late initialization of sp->goahead
to false in tzload, causing localsub to return NULL in the "cannot happen"
case. The fix is belt and suspenders:
	- initialize sp->goback and sp->goahead very early in tzload
	- replace all malloc calls with callocs, and remove the bogus
	  casts (it is not the 70's anymore!)
2010-02-17 17:25:55 +00:00
wiz
368f216930 Remove trailing whitespace. Use Fn when referencing functions. Sort sections.
New sentence, new line.
2010-02-03 08:47:40 +00:00
christos
e89ba73a47 According to TOG:
- asctime{,_r}, ctime{,_r} may return NULL; document that, and avoid coredumps.
- gmtime{,_r}, localtime{,_r} may return NULL and set EOVERFLOW, document and
  set errno.
- when mktime returns (time_t)-1, make it set EOVERFLOW and document it.

XXX: Should be pulled up to 5.x
2010-02-02 19:04:37 +00:00
joerg
635076e0b1 Fix mdoc(7)/man(7) mix up. 2010-01-08 23:14:13 +00:00
joerg
69ebc5167f Fix up mix of man(7)/mdoc(7). 2010-01-08 19:20:21 +00:00
joerg
71f3cc8605 Try to fixup the mess of mdoc(7)/man(7) mixture as created by the merge. 2010-01-08 17:16:56 +00:00
tsutsui
47ef4e54e9 Include "nbtool_config.h" for src/tools/zic/ and
remove bogus -DNOID to disable __RCSID().

XXX: should we also remove #ifndef lint from scheck.c and zic.c?
2010-01-02 10:42:49 +00:00
mlelstv
86162a51cc Import tzcode2009k.
- now understands 64bit time_t and 64bit data in timezone files.
- localtime(), gmtime(), asctime() and ctime() may now fail with
  a NULL result if time_t cannot be represented by struct tm.
2009-12-31 22:49:15 +00:00
matt
f3848e2eb2 Back errant change due to botched merge. 2009-12-14 20:45:02 +00:00
matt
c7af27854b Suppress a warning if time_t is __int64_t 2009-12-14 05:51:56 +00:00
mbalmer
4c993ba354 one more the 2009-11-22 18:07:39 +00:00
mlelstv
7aea3a0d0a import tzcode2009k 2009-10-25 16:20:16 +00:00
mlelstv
df0cec4903 With 64bit time_t years can be negative and lapyear computation
requires rounding down. This avoids an infinite loop in localtime().
2009-10-24 17:01:04 +00:00
ginsbach
48dc241150 Crank date for previous. 2009-05-24 02:30:17 +00:00
ginsbach
98fa92ea04 Add %s to strptime(3) to make symmetric with strftime(3). 2009-05-24 02:25:43 +00:00
jakllsch
6a0e3cf139 Update MLINKS to match the flist. 2009-05-15 02:23:42 +00:00
ginsbach
c8da0e5fef Add the getdate(3) function and getdate_err value, conforming to IEEE
Std 1003.1 (``POSIX.1'') and the Open Group Base Specifications X/Open
System Interfaces extension (``XSI'').
2009-05-14 02:37:35 +00:00
wiz
15dfd8155b Drop trailing whitespace. 2009-05-01 21:34:45 +00:00
ginsbach
8f7e60d3bc Extend %z to support all RFC-2822 timezone formats. 2009-05-01 20:15:05 +00:00
lukem
b129d71a05 Fix -Wcast-qual issue 2009-04-23 01:39:47 +00:00
joerg
868fe66e65 Add missing quotes. 2009-04-11 16:29:09 +00:00
joerg
71c479831e Fix markup. 2009-04-11 16:13:49 +00:00
joerg
a7d7c3857f Remove redundant .IP. Remove use of .Xo/Xc to workaround ancient macro
argument limit.
2009-03-10 23:25:32 +00:00
joerg
997634fe14 Fix preamble to match order set out by mdoc(7). Discussed with wiz. 2009-03-09 19:24:26 +00:00
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
wiz
472351e13d Use
.In header.h
instead of
.Fd #include \*[Lt]header.h\*[Gt]
Much easier to read and write, and supported by groff for ages.
Okayed by ross.
2003-04-16 13:34:34 +00:00
christos
7c8015e7ec s/_REENT/_REENTRANT/ 2003-01-18 17:10:56 +00:00
itojun
9134efabd0 use strlcpy where it is more appropriate. 2002-11-17 01:51:24 +00:00
kleink
ae475f81fe Fix typo UCT -> UTC; from Christian Biere in PR lib/19007. 2002-11-10 19:51:47 +00:00
itojun
76423b2378 license clarification, from openbsd 2002-10-02 06:56:24 +00:00
wiz
52d8d77b60 New sentence, new line. From Robert Elz. 2002-10-01 18:15:59 +00:00
yamt
83b485596b note that month and weekday names are case-insensitive.
from OpenBSD.
2002-08-18 06:43:32 +00:00
yamt
7c3f1b1f60 note that the contents of the array are undefined in the error case. 2002-08-18 06:31:09 +00:00
yamt
e72273def3 - Mention leap seconds as the reason for (00-61)
- include blurb about ISO 8601 dates straight from strftime.c
from OpenBSD.
2002-08-18 06:27:49 +00:00
wiz
d56bb7c2ec __STDC__ is always defined on NetBSD. 2002-05-26 11:48:00 +00:00
bjh21
bde73607cc Pull in config.h when we're building zic as a host tool.
This makes zic compilable with Sun WorkShop C 5.0.
2002-04-26 17:31:54 +00:00
groo
5fe77d3e2d botched strncpy -> strlcpy
from xs@kittenz.org
2002-04-16 19:20:51 +00:00
ross
b47221844a fix isolated collateral damage from <>& churn 2002-02-10 02:46:27 +00:00
ross
dc5571b22e Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:21:55 +00:00
ross
814f296b77 Generate <>& symbolically. 2002-02-07 07:00:09 +00:00
kleink
d4a9806f67 Delint me harder. 2002-01-29 12:58:32 +00:00
kleink
4521dc7de4 Merge tzcode2002b. 2002-01-29 12:40:33 +00:00
kleink
91b3efb135 Import tzcode2002b. 2002-01-29 12:30:41 +00:00
wiz
b3936fdebf Fix .Bd argument. Pointed out by mrg. 2002-01-02 03:25:08 +00:00
kleink
327f6e3bc2 Document %z. 2001-12-13 22:11:27 +00:00
kleink
ea8bbaf8e1 Sort conversion specifiers. 2001-12-10 10:01:38 +00:00
lukem
50f5afd52e fix WARNS=2 (-Wshadow) warnings 2001-11-04 13:57:29 +00:00