Commit Graph

171 Commits

Author SHA1 Message Date
Mike Makonnen
6c688436bb 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
Mike Makonnen
f23f149866 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
Mike Makonnen
764628c056 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
Mike Makonnen
fe71e0b83d 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
Jacques Vidrine
e0554a531f 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
Tim J. Robbins
33161c7a6e strptime(), like strftime(), does not handle multibyte characters
in the format string correctly.
2003-01-04 09:50:04 +00:00
Tim J. Robbins
e751b764f8 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
Ruslan Ermilov
3ca4c01eea mdoc(7) police: Fixed a few .Fa abuses. 2002-12-19 09:33:34 +00:00
Ruslan Ermilov
454e286809 mdoc(7) police: excessive quotes. 2002-12-19 08:13:27 +00:00
Ruslan Ermilov
1fae73b137 mdoc(7) police: "The .Fn function". 2002-12-18 12:45:11 +00:00
Tim J. Robbins
e4ceb70f7a 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 Wemm
878c9687ec 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 Wemm
a5bf4e71ef 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
Ruslan Ermilov
c51d717f0c libc_r wasn't so tied to libc for 22 months. 2002-11-18 09:50:57 +00:00
Tim J. Robbins
2fe3e5cda7 Add cross-references to the wide character counterparts of these functions. 2002-10-15 10:11:53 +00:00
Tim J. Robbins
58d38e2520 Style: One space between "restrict" qualifier and "*". 2002-09-06 11:24:06 +00:00
Peter Wemm
b331ec93c0 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 Drehmel
2caa6a5afe 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 Drehmel
620035ef89 - 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 Drehmel
d542f511a0 - 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
Andrey A. Chernov
1491b31e18 Style fixes 2002-08-07 16:49:20 +00:00
Garrett Wollman
8466ae9033 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 Cobbs
c05b5b0453 Grammar nit: treat "contents" as plural. 2002-05-31 22:26:19 +00:00
Alfred Perlstein
1d145de849 Remove use of __P() (actually P()) from code now that it's no longer
available.
2002-05-28 20:12:42 +00:00
Alfred Perlstein
a82bbc730e Assume __STDC__, remove non-__STDC__ code.
Submitted by: keramida
2002-05-28 17:03:12 +00:00
Garrett Wollman
0d84b47e9c 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
David E. O'Brien
1114a754ed 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
David E. O'Brien
333fc21e3c 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
David E. O'Brien
8fb3f3f682 Remove 'register' keyword. 2002-03-21 18:49:23 +00:00
Alexey Zelkin
bcbeac34ae * style(9)'fy
* declare prototype for __time_load_locale() in timelocal.h
2002-01-24 15:07:44 +00:00
Matthew Dillon
170ac683f2 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
Alexey Zelkin
52d6b43026 Add my e-mail to copyrights 2001-12-11 16:00:47 +00:00
Matthew Dillon
e8627df69d Add time_to_int(), int_to_time(), time_to_long(), long_to_time(). 2001-10-28 20:13:16 +00:00
Matthew Dillon
237c4e3a9e 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
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Ruslan Ermilov
c4d9468ea0 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
Dima Dorfman
7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Dima Dorfman
427fc5ed6f Recognize the %s format.
Submitted by:	Thomas Zenker <thz@lennartz-electronic.de> and
		    Maxim Konovalov <maxim@macomnet.ru>, respectively
Reviewed by:	-audit
2001-07-13 13:59:24 +00:00
Ruslan Ermilov
a307d59838 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 13:41:46 +00:00
Dima Dorfman
70d51341bf mdoc(7) police: remove extraneous .Pp before and/or after .Sh. 2001-07-09 09:54:33 +00:00
Ruslan Ermilov
10ae6ece36 Document "normalizing" behavior of mktime(3).
PR:		bin/28313
Reviewed by:	bde, wollman
MFC after:	1 week
2001-06-23 08:57:40 +00:00
Garrett Wollman
80d444c883 Don't mung the user's tm_sec field if we don't need to. (Belt-and-suspenders
version.)

PR:		bin/27630
Submitted by:	Arthur David Olson <ado@nci.nih.gov>
Obtained from:	Timezone mailing-list <tz@elsie.nci.nih.gov>
MFC after:	1 month
2001-06-05 20:13:28 +00:00
Ruslan Ermilov
4a558355e5 MAN[1-9] -> MAN. 2001-03-27 17:27:19 +00:00
Andrey A. Chernov
58dae109b5 Get rid of non-standard %E[Ff] formats, userland apps already fixed 2001-03-21 14:52:12 +00:00
Andrey A. Chernov
50b4c62c47 Oops, back out prev. change - POSIX require %y in d_fmt
Cosmetique - use exact POSIX string for %c
2001-03-21 14:12:37 +00:00
Andrey A. Chernov
e81765cbbc Replace %y with %Y 2001-03-21 13:55:09 +00:00
Andrey A. Chernov
16a7ebb62d Fix typo in the comment 2001-03-18 12:20:38 +00:00
Andrey A. Chernov
faeb1b822a Relax local FreeBSD restrictions on 3 chars abbrev. name length and %c format
since they not allows POSIXly legal locale data. Currently, if relaxed form
POSIXly legal locale data will be used right now, some programs will be broken,
but it means that either locale data or programs must be fixed, not the library.

Introduce non-standard md_order (month/day order) locale field to be used later
via nl_langinfo(). Currently %EF and %Ef emulated using this field, but they
planned for remove in future in favour of nl_langinfo() test field.

Implement %F per POSIX
2001-03-18 11:58:15 +00:00
Andrey A. Chernov
f7c5bca2ef Make 'A' and 'a', 'B' and 'b' the same, per POSIX 2001-03-18 08:41:06 +00:00
Andrey A. Chernov
50bab1e6fb Implement ampm_fmt (%r) per POSIX 2001-03-02 22:10:04 +00:00