ftp.nice.ch/pub/next/unix/mail/zend.1.0.s.tar.gz#/zend-1.0/include/p-time.h

This is p-time.h in view mode; [Download] [Up]

/*+++*
 *  RCS		$Id: p-time.h,v 1.6 1993/02/02 21:00:42 gerben Exp $
 *  title:	p-time.h
 *  abstract:	portable Posix-compliant <time.h>.
 *  author:	T.R.Hageman, Groningen, The Netherlands
 *  created:	September 1992
 *  modified:	(see RCS Log at end)
 *  copyleft:
 *
 *		Copyright (C) 1992  Tom R. Hageman.
 *
 *	This is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *	(at your option) any later version.
 *
 *	This software is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this software; if not, write to the Free Software
 *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *  description:
 *
 *	This is a Posix/ANSI C-compatible version of <time.h> for both Posix
 *	and non-Posix systems.
 *
 *	Notes:
 *
 *	 o  If _P_TYPEDEF is defined, typedefs are used instead of #defines.
 *	    This may be useful to port this file to a new system (by watching
 *	    the types clash with stuff typedef-ed in <sys/types.h>)
 *
 *	 o  Nothing is done yet to handle BSD vs. SYSV timezone differences.
 *---*/

#ifndef _P_TIME_H_
#define _P_TIME_H_	0x104

#ifndef _PORTDEFS_H_ 
#   include "portdefs.h"
#endif

#ifndef _P_TYPES_H_
#   include "p-types.h"
#endif

/* This is to get definition of `struct tm'. */

#ifdef TM_IN_SYS_TIME			/* GNU Autoconfig. */
#   ifndef _SYS_TIME_H_
#	include <sys/time.h>
#	define _SYS_TIME_H_
#   endif
#else
#   ifndef _TIME_H_			/* interlock with "utime.h" */
#	include <time.h>
#	define _TIME_H_
#   endif
#endif


#ifndef __STRICT_POSIX__
#   ifndef CLOCKS_PER_SEC
#	ifdef CLK_TCK			/* Draft ANSI / Posix. */
#	    define CLOCKS_PER_SEC	CLK_TCK
#	endif
#   endif
#endif


#if !(__POSIX__ || _ANSI_LIBRARY_)

/* note the use of _ANSI_LIBRARY_ instead of _ANSI_HEADERS_ since that 
   claims only the _existence_ of all ANSI C headers, and claims (virtually)
   nothing about its contents. */

#   ifndef time_t
#	ifdef TIME_T
#	    define time_t	TIME_T
#	else
#	    ifndef _TIME_T_
#		ifndef _TIME_T
#		    if ( \
			/* Add any systems that don't declare `time_t' */0)
#			ifdef _P_TYPEDEF
				typedef long	time_t;
#			else
#				define time_t	long
#			endif
#		    endif
#		endif
#	    endif
#	endif
#   endif

#   ifndef clock_t
#	ifdef CLOCK_T
#	    define CLOCK_T	clock
#	else
#	    ifndef _CLOCK_T_
#		ifndef _CLOCK_T
#		    if !( \
			 /* Add any systems that declare `clock_t' */0)
#			if _HAS_UNSIGNED_
#			    ifdef _P_TYPEDEF
				typedef unsigned long	clock_t;
#			    else
#				define clock_t	unsigned long
#			    endif
#			else
#			    ifdef _P_TYPEDEF
				typedef long	clock_t;
#			    else
#				define clock_t	long
#			    endif
#			endif
#		    endif
#		endif
#	    endif
#	endif
#   endif

# if !__NO_PROTO__
extern char *		asctime		__(( const struct tm *_(timeptr) ));
#   ifndef __STRICT_POSIX__ /* ANSI C extension. */
extern clock_t		clock		__(( void ));
#   endif
extern char *		ctime		__(( const time_t *_(timer) ));
#   ifndef __STRICT_POSIX__ /* ANSI C extension. */
extern double		difftime	__(( time_t _(t1), time_t _(t0) ));
#   endif
extern struct tm *	gmtime		__(( const time_t *_(timer) ));
extern struct tm *	localtime	__(( const time_t *_(timer) ));

/* the next two are ANSI C / Posix extensions. */
extern time_t		mktime		__(( struct tm *_(timeptr) ));
extern size_t		strftime	__(( char *_(buf), size_t _(maxsize),
					     const char *_(format),
					     const struct tm *_(timeptr) ));

extern time_t		time		__(( time_t *_(timer) ));

#   ifndef __STRICT_ANSI__ /* Posix extension; also available on Sys. V UNIX. */
#	if !__NO_TRIV_PROTO__
extern void		tzset		__(( void ));
#	endif
#	if __SYSV__ /* I'm not sure about this one. */
extern char		tzname[2];	
#	endif
#   endif
# endif /* __NO_PROTO__ */

#endif /* !(__POSIX__ || _ANSI_LIBRARY_) */

#endif /* _P_TIME_H_ */

/*======================================================================*
 * $Log: p-time.h,v $
 * Revision 1.6  1993/02/02  21:00:42  gerben
 * *** empty log message ***
 *
 * Revision 1.5  1992/12/18  22:57:44  tom
 * fix `struct time' -> `struct tm'! in prototypes.
 *
 * Revision 1.4  1992/10/23  04:11:15  tom
 * add _P_TYPEDEF conditional; add __NO_TRIV_PROTO__;
 * declare tzname if __SYSV__.
 *
 * Revision 1.3  1992/10/21  19:40:23  tom
 * *** empty log message ***
 *
 * Revision 1.2  1992/10/20  16:52:19  tom
 * revert to __STRICT_POSIX__
 *
 * Revision 1.1  1992/10/14  13:38:20  tom
 * rename to "p-<header>".
 *
 * Revision 1.0  1992/10/09  07:07:34  tom
 * Initial revision
 *
 *======================================================================*/

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.