Commit Graph

186 Commits

Author SHA1 Message Date
ru
1f12ffeb1d Expand contractions. 2005-02-13 23:45:54 +00:00
ru
d65df7068b Expand *n't contractions. 2005-02-13 22:25:33 +00:00
ru
8ac78e8e38 Sort sections. 2005-01-20 09:17:07 +00:00
ru
e1a89ac65f Scheduled mdoc(7) sweep. 2005-01-11 20:50:51 +00:00
delphij
54171cfd68 Add glibc-style strftime(3) padding specifiers, namely, -(no padding),
_(use space as padding), and 0(zero padding).

These GNU extensions are widely used ones that is worthy for us to
have.

Discussed with:	stefanf, roam, -current
Approved by:	murray
Prodded by:	ports/72722, ports/72723
MFC After:	1 month
2004-11-04 08:34:57 +00:00
peter
f3e94c7baa struct tm.tm_year is listed as 'years since 1900', and is signed. On
64 bit systems, years roughly -2^31 through 2^31 can be represented in
time_t without any trouble.  32 bit time_t systems only range from
roughly 1902 through 2038.  As a consequence, none of the date munging
code for all the various calendar tweaks before then is present.  There
are other problems including the fact that there was no 'year zero' and
so on.  So rather than get excited about trying to figure out when the
calendar jumped by two weeks etc, simply disallow negative (ie: prior to
1900) years.

This happens to have an important side effect.  If you bzero a 'struct
tm', it corresponds to 'Jan 0, 1900, 00:00 GMT'.  This happens to be
representable (after canonification) in 64 bit time_t space.  Zero tm
structs are generally an error and mktime normally returns -1 for them.
Interestingly, it tries to canonify the 'jan 0' to 'dec 31, 1899', ie:
year -1.  This conveniently trips the negative year test above, which
means we can trivially detect the null 'tm' struct.

This actually tripped up code at work. :-/  (Don't ask)
2004-08-24 00:15:37 +00:00
ru
4a6cd75809 Mechanically kill hard sentence breaks. 2004-07-02 23:52:20 +00:00
stefanf
5426938477 Merge changes from the tzcode2004a import. Wherever possible I tried to bring
us closer to the vendor branch.

Requested by:	wollman
2004-06-14 10:31:52 +00:00
stefanf
46e48acae4 Remove a stale reference to %Ef and %EF from a comment. 2004-06-13 16:20:23 +00:00
kensmith
7ee450a7fc Change defualt time zone from GMT to UTC. This will not be MFC-ed, and
was done before 5-STABLE on purpose...
2004-06-11 03:34:02 +00:00
stefanf
b9b627bcfb Remove a couple of casts added for an ancient Sun compiler.
Approved by:	das (mentor)
2004-06-08 12:20:40 +00:00
nectar
14043ded4f Detect range errors when using the %s specifier. Previously, LONG_MAX
was rejected as a range error, while any values less than LONG_MIN
were silently substituted with LONG_MIN.  Furthermore, on some
platforms `time_t' has less range than `long' (e.g. alpha), which may
give incorrect results when parsing some strings.
2003-11-17 04:19:15 +00:00
ru
b8e742a388 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
jkh
39ef992134 Fixes to locale code to properly use indirect pointers in order to prevent
memory leaks (fixes bugs earlier purported to be fixed).
Submitted by:	Ed Moy <emoy@apple.com>
Obtained from:	Apple Computer, Inc.
MFC after:	2 weeks
2003-06-13 00:14:07 +00:00
mtm
ae370404e1 Backout my changes in rev. 1.32 and 1.33. There is some code that depends
on the previous behaviour. This also brings strptime(3) behaviour back in line
with the other BSDs.

Approved by:	markm (mentor)
2003-04-30 10:25:57 +00:00
mtm
ecd30e037d Zero out the struct tm supplied by the caller. Otherwise,
strange things might happen when garbage values in the struct
get passed in to localtime_r() and family.

Noticed by:	marcus
Approved by:	markm (mentor)(implicit)
2003-04-05 05:46:43 +00:00
mtm
3e5e958278 Fill in the rest of the fields in the resulting struct tm
from strptime(3). Previously, they would get filled only
for the %s specifier and as a side effect of using the
the %Z specifier with a GMT time zone.

PR:		misc/48993
Approved by:	markm (mentor)
Silence on:	-standards
2003-03-29 11:55:37 +00:00
mtm
0dd1dbbc69 Ditch a static global and the mutex that protected it. Achieve the
desired strptime(3) reentrancy by adding an extra argument to _strptime()
instead.

Approved by:	markm (mentor)
MFC:		4 weeks
2003-03-12 19:22:57 +00:00
nectar
1915d3d765 Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).
Only warnings that could be fixed without changing the generated object
code and without restructuring the source code have been handled.

Reviewed by:	/sbin/md5
2003-02-16 17:29:11 +00:00
tjr
02e186f5f1 strptime(), like strftime(), does not handle multibyte characters
in the format string correctly.
2003-01-04 09:50:04 +00:00
tjr
44c6151f31 Mention in the BUGS section that strftime() does not handle multibyte
characters in the format string correctly.
2003-01-04 09:47:40 +00:00
ru
bca41a417f mdoc(7) police: Fixed a few .Fa abuses. 2002-12-19 09:33:34 +00:00
ru
ddbf7ab583 mdoc(7) police: excessive quotes. 2002-12-19 08:13:27 +00:00
ru
5151e61327 mdoc(7) police: "The .Fn function". 2002-12-18 12:45:11 +00:00
tjr
09fe083601 Document what happens when the format string contains insufficient
conversion specifications to completely specify the resulting struct tm.

PR:		46331
Submitted by:	Christian S.J. Peron
MFC after:	2 weeks
2002-12-18 05:00:54 +00:00
peter
27c46fcccf Do not guarantee an overflow of tm_year when doing the binary search in
localtime/mktime/tmcomp and friends on ia64.

Approved by:	re
2002-12-05 19:54:47 +00:00
peter
75b5d9f3f9 Replace rev 1.33 with a real fix. The problem was integer overflows
when trying to store the year in a signed int.  The maximum time_t on ia64
is around 292 billion years in the future, but 'int' and struct tm.tm_year
can only represent then ext 2.1 billion years or so.

This solves the problem of mktime/localtime looping on ia64.  Unfortunately,
the standards say that tm_year is an 'int', so we are still stuck with a
y2147483647 bug.  bash2's configure script looks for bugs in mktime() and
fails on ia64 because of this.  However, mktime() on FreeBSD fails the test
normally anyway so this is no big loss.

This change does not affect any other platforms besides ia64.

Approved by:	re
2002-12-02 01:05:08 +00:00
ru
839c9a1a35 libc_r wasn't so tied to libc for 22 months. 2002-11-18 09:50:57 +00:00
tjr
ccc1c0b56a Add cross-references to the wide character counterparts of these functions. 2002-10-15 10:11:53 +00:00
tjr
e841a730a7 Style: One space between "restrict" qualifier and "*". 2002-09-06 11:24:06 +00:00
peter
9df0fa4929 Fix a nasty bug exposed by mktime() when time_t is significantly bigger
than 32 bits.  It was trying to figure out things like the day of week
of when time_t is roughly 2^62 etc.  Make a better guess for the starting
point for the binary search that works on both 32 and 64 bit types.  I have
been using this for a while now.
2002-09-03 04:34:10 +00:00
robert
2877957282 Use one line for each function argument to keep the line
width smaller than 80 columns.

Thanks to Ruslan for an explanation of multiple ways to
achieve this.
2002-08-15 18:57:57 +00:00
robert
3a77f79d44 - Add the 'restrict' qualifier to the function definition of
strftime(3) for IEEE Std 1003.1-2001 compliance and remove
   excessive usage of the 'const' qualifier that was neither
   present in the prototype in the publice header, nor in the
   local prototype just above the function definition.
 - Replace the K&R function definition with a ANSI-C one.
 - Update the prototype of strftime(3) in its manual page.
2002-08-14 23:20:48 +00:00
robert
78711cadb9 - Add the C99 'restrict' qualifier using the '__restrict' macro to
function prototype and definition of strptime(3).
 - Update the manual page.
2002-08-14 22:36:22 +00:00
ache
667facf7e8 Style fixes 2002-08-07 16:49:20 +00:00
wollman
a9b3db35d5 Move dillon's time conversion functions to a new header <timeconv.h>.
Since they were never documented and have never appeared in a FreeBSD
release, no repo-copy of the header is done.  This removes namespace
pollution from <time.h>.
2002-06-17 01:42:33 +00:00
archie
290079d533 Grammar nit: treat "contents" as plural. 2002-05-31 22:26:19 +00:00
alfred
6aea2de236 Remove use of __P() (actually P()) from code now that it's no longer
available.
2002-05-28 20:12:42 +00:00
alfred
c3f67aab4e Assume __STDC__, remove non-__STDC__ code.
Submitted by: keramida
2002-05-28 17:03:12 +00:00
wollman
c5e706f3d5 Fix fd leak. Threads people: does the call above to `access' need to be
underscored as well?

PR:		37717
Submitted by:	fred@clift.org (slightly modified by me)
2002-05-03 17:28:28 +00:00
obrien
3b58da09ea Fix the style of the SCM ID's.
I believe have made all of libc .h's as consistent as possible.
2002-03-22 23:42:05 +00:00
obrien
8bfc34249b Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.
2002-03-22 21:53:29 +00:00
obrien
e4063e15db Remove 'register' keyword. 2002-03-21 18:49:23 +00:00
phantom
7974fd2f78 * style(9)'fy
* declare prototype for __time_load_locale() in timelocal.h
2002-01-24 15:07:44 +00:00
dillon
2b4b1cef8e I've been meaning to do this for a while. Add an underscore to the
time_to_xxx() and xxx_to_time() functions.  e.g. _time_to_xxx()
instead of time_to_xxx(), to make it more obvious that these are
stopgap functions & placemarkers and not meant to create a defacto
standard.  They will eventually be replaced when a real standard
comes out of committee.
2002-01-19 23:20:02 +00:00
phantom
38134b6b87 Add my e-mail to copyrights 2001-12-11 16:00:47 +00:00
dillon
720e70cb89 Add time_to_int(), int_to_time(), time_to_long(), long_to_time(). 2001-10-28 20:13:16 +00:00
dillon
cdfce93ee2 Add routines to convert time_t to/from fixed-bit fields. These routines
serve two purposes: (1) so we can maintain backwards compatibility with
protocols (rwhod, dump, etc...) that either assume time_t is 32 bits or
assume sizeof(time_t) == sizeof(int), or make other similar assumptions.
(2) To tag such routines (by the presence of these calls) for future
cleanup/extension work.

The 32->64 routine, time32_to_time() (when time_t is 64 bits, that is),
is defined specifically to implement temporal locality to properly set the
msb bits of a 64 bit time_t quantity, using the 50 year rule.  The locality
code has not been implemented yet (and doesn't need to be for a while),
but that is the intent.   This will allow us to maintain backwards protocol
compatibility past 2038.

These routines are intended to be platform and time_t agnostic.

MFC after:	1 week
2001-10-28 19:54:49 +00:00
ru
727c2b4b9e mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
ru
09d142dfd5 mdoc(7) police:
Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text.
Not only this slows down the mdoc(7) processing significantly, but it also
has an undesired (in this case) effect of disabling hyphenation within the
entire enclosed block.
2001-08-07 15:48:51 +00:00