Commit Graph

32 Commits

Author SHA1 Message Date
David Schultz
6d2f64c103 Define CLOCK_* and TIMER_* in time.h, where they are supposed to be. 2005-04-02 12:33:27 +00:00
Marcel Moolenaar
12eb46c8bb Change the definition of NULL on ia64 (for LP64 compilations) from
an int constant to a long constant. This change improves consistency
in the following two ways:
1. The first 8 arguments are always passed in registers on ia64, which
   by virtue of the generated code implicitly widens ints to longs and
   allows the use of an 32-bit integral type for 64-bit arguments.
   Subsequent arguments are passed onto the memory stack, which does
   not exhibit the same behaviour and consequently do not allow this.
   In practice this means that variadic functions taking pointers
   and given NULL (without cast) work as long as the NULL is passed
   in one of the first 8 arguments. A SIGSEGV is more likely the
   result if such would be done for stack-based arguments. This is
   due to the fact that the upper 4 bytes remain undefined.
2. All 64-bit platforms that FreeBSD supports, with the obvious
   exception of ia64, allow 32-bit integral types (specifically NULL)
   when 64-bit pointers are expected in variadic functions by way of
   how the compiler generates code. As such, code that works correctly
   (whether rightfully so or not) on any platform other than ia64, may
   fail on ia64.

To more easily allow tweaking of the definition of NULL, this commit
removes the 12 definitions in the various headers and puts it in a
new header that can be included whenever NULL is to be made visible.

This commit fixes GNOME, emacs, xemacs and a whole bunch of ports
that I don't particularly care about at this time...
2003-12-07 21:10:06 +00:00
Tim J. Robbins
58d38e2520 Style: One space between "restrict" qualifier and "*". 2002-09-06 11:24:06 +00:00
Mike Barcroft
dd1b6791a8 Now that _BSD_CLK_TCK_ and _BSD_CLOCKS_PER_SEC_ are the same on all
architectures, move the definition directly into <time.h> and finish
the removal of <machine/ansi.h>.
2002-09-03 00:06:58 +00:00
Mike Barcroft
abbd890233 o Merge <machine/ansi.h> and <machine/types.h> into a new header
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
  macros, which are only MD because of gratuitous differences between
  architectures.
o Change all headers to make use of this.  This mainly involves
  changing:
    #ifdef _BSD_FOO_T_
    typedef	_BSD_FOO_T_	foo_t;
    #undef _BSD_FOO_T_
    #endif
  to:
    #ifndef _FOO_T_DECLARED
    typedef	__foo_t	foo_t;
    #define	_FOO_T_DECLARED
    #endif

Concept by:	bde
Reviewed by:	jake, obrien
2002-08-21 16:20:02 +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
Garrett Wollman
b3ab54e105 The thread-safe time functions appear to have been introduced as of
ISO 9945-1: 1996 (according to the change bars therein), which corresponds
to 1003.1c-1995.  Give them appropriate visibility protection.
2002-06-27 20:18:45 +00:00
Garrett Wollman
b8c5405411 Resort namespace blocks into a more sensible order. Delete a redundant
comment.
2002-06-27 18:40:51 +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
Garrett Wollman
73cf72f565 Clean up a bit of namespace pollution which crept in with the last rev.
Submitted by:	bde
2002-06-17 01:31:25 +00:00
Garrett Wollman
1cb2a9ae56 Partially fix namespace visibility issues by using new visibility macros.
Some issues still remain, and will require research in old POSIX standards
if we care to get them right.
2002-06-15 23:35:37 +00:00
Warner Losh
bb28f3c29b Breath deep and take __P out of the system include files.
# This appears to not break X11, but I'm having problems compiling the
# glide part of the server with or without this patch, so I can't tell
# for sure.
2002-03-23 17:24:55 +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
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
Poul-Henning Kamp
5b32a38a1a It's not CUT (the french would accept that back in 1879) and TUC wasn't
palatable to the rest of the world.  UTC was the compromise.

PR:		26238
Submitted by:	Ying-Chieh Liao <ijliao@terry.dragon2.net>
2001-03-31 07:24:35 +00:00
Dmitrij Tejblum
de16000123 Make ctime_r, asctime_r, gmtime_r, and localtime_r available in libc. 1999-01-04 20:45:20 +00:00
Dmitrij Tejblum
f0cefaccae Change return type of strptime from const char* to char*.
const char* was wrong and nonstandard.
1998-09-12 21:13:29 +00:00
Joseph Koshy
2bd323977f Add extern declaration for `tzname[]' to make this header comply better
to POSIX90.

2-rounds-of-review-by: bde
1998-08-21 01:21:26 +00:00
Poul-Henning Kamp
3f643d87bb ctime_r and asctime_r are not implemented.
prototypes in time.h do not match POSIX.

PR:		6345
Reviewed by:	phk
Submitted by:	Dmitry Khrustalev <dima@xyzzy.machaon.ru>
1998-04-19 06:47:25 +00:00
Peter Dufault
8a6472b723 Finish _POSIX_PRIORITY_SCHEDULING. Needs P1003_1B and
_KPOSIX_PRIORITY_SCHEDULING options to work.  Changes:

Change all "posix4" to "p1003_1b".  Misnamed files are left
as "posix4" until I'm told if I can simply delete them and add
new ones;

Add _POSIX_PRIORITY_SCHEDULING system calls for FreeBSD and Linux;

Add man pages for _POSIX_PRIORITY_SCHEDULING system calls;

Add options to LINT;

Minor fixes to P1003_1B code during testing.
1998-03-28 11:51:01 +00:00
Joerg Wunsch
37486f035f Import strptime(3) into libc. We've got permission by Kevin Ruddy to
modify the original `no modifications' copyright message, and i've
included his mail into the source file.

The common localization functions between strptime(3) and strftime(3)
have been broken out into timelocal.[ch].
1997-08-09 15:43:59 +00:00
Peter Wemm
f154fbdaa1 struct timespec needs to be useable with just <time.h>, but needs to not
conflict with the kernel visible one.  Make the new stuff not visible if
_ANSI_SOURCE or _POSIX_SOURCE is defined (!) because the new things are
not part of the base 1003.1-1990 standard (or ansi).
1997-05-13 09:33:24 +00:00
Andrey A. Chernov
9e0eb33e2f Add clockid_t definition like in sys/types.h to allow time.h
to be included without sys/types.h, it fixes broken groff compilation
1997-05-13 09:25:03 +00:00
Peter Wemm
2c97335b81 Oops, move clock_*() and nanosleep() to time.h
Submitted by: Peter Dufault <dufault@hda.com>
1997-05-12 12:58:40 +00:00
Jeffrey Hsu
b0e998dc26 Change prototypes for gmtime_r() and localtime_r() in accordance with
IEEE pthreads specification.
1996-11-11 09:22:13 +00:00
Julian Elischer
f70177e76e Reviewed by: julian and (hsu?)
Submitted by:	 John Birrel(L?)

changes for threadsafe operations
1996-01-22 00:02:33 +00:00
Bruce Evans
02a7dd7637 Define CLK_TCK right. 1995-02-08 18:37:14 +00:00
Bruce Evans
339b0f68f2 Define CLOCKS_PER_SEC.
Define CLK_TCK only if _ANSI_SOURCE is not defined.

Don't include <machine/limits.h> to get the definition of CLK_TCK.
CLK_TCK should never have been defined there, and the inclusion
polluted the namespace.
1995-02-03 21:47:48 +00:00
Andrey A. Chernov
8c2f5ad758 Declare useful functions (timelocal() and timegm()) 1994-12-26 10:19:41 +00:00
Rodney W. Grimes
59deaec541 BSD 4.4 Lite Include Sources 1994-05-24 09:57:34 +00:00