#ifdef AIX_PROD
/* @(#)73	1.8  src/time/common/utc.h, dts.src, os2dce21.dss, 960602a.1 5/17/95 09:48:33  */
/*
 *   COMPONENT_NAME: dts.src
 *
 *   FUNCTIONS: none
 *
 *   ORIGINS: 72
 *
 */
#endif /* AIX_PROD */
/*
 * @OSF_COPYRIGHT@
 * COPYRIGHT NOTICE
 * Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
 * ALL RIGHTS RESERVED (DCE).  See the file named COPYRIGHT.DCE in the
 * src directory for the full copyright text.
 */
/*
 * HISTORY
 * $Log: utc.h,v $
 * Revision 1.2.8.4  1994/09/15  17:46:12  tom
 *      Fix timespec to aling with later POSIX, now delcare tv_sec as time_t.
 *      Also change reltimespec tv_sec to time_t. (OT 12186)
 *      [1994/09/15  16:25:27  tom]
 *
 * Revision 1.2.8.3  1994/08/16  18:12:51  cbrooks
 * 	CR 11494
 * 	[1994/08/09  19:00:00  cbrooks]
 *
 * Revision 1.2.8.2  1994/05/12  15:17:34  rhw
 * 	continued code cleanup & merging
 * 	[1994/05/09  18:46:32  rhw]
 * 
 * 	first pass at code cleanup (compiler warnings, function prototypes)
 * 	[1994/04/25  14:10:49  rhw]
 * 
 * Revision 1.2.8.1  1994/04/21  22:05:16  cbrooks
 * 	CR 3231, 8353
 * 	[1994/04/21  20:05:21  cbrooks]
 * 
 * Revision 1.2.4.5  1993/02/03  16:11:00  tom
 * 	7068 - Check AES_SOURCE not __OSF__ to see if we can include
 * 	sys/timers.h for the timespec struct.
 * 	[1993/02/02  15:44:52  tom]
 * 
 * Revision 1.2.4.4  1993/01/19  16:10:12  jd
 * 	Back out the change untill we know all of the dependencies. It's
 * 	causing no end of problems with the nightly builds.
 * 	[1993/01/19  14:44:15  jd]
 * 
 * Revision 1.2.4.2  1992/12/30  20:40:12  htf
 * 	Embedding copyright notice
 * 	[1992/12/30  19:08:45  htf]
 * 
 * Revision 1.2.2.3  1992/05/11  13:34:41  comuzzi
 * 	Fix conditional so that it compiles on DEC's OSF/1. Fixes defect 3348.
 * 	[1992/05/08  16:05:55  comuzzi]
 * 
 * Revision 1.2.2.2  1992/01/22  22:34:01  jim
 * 	 Changes to build on the POWER platform.
 * 	[1992/01/22  21:24:09  jim]
 * 
 * Revision 1.2  1992/01/19  22:14:51  devrcs
 * 	Dropping DCE1.0 OSF1_misc port archive
 * 
 * $EndLog$
 */
/*
*/
/*
 *  OSF DCE Version 1.0 
 */
/*
 * COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1990. ALL RIGHTS RESERVED.
 *
 * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
 * ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH  LICENSE AND WITH THE
 * INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY  OTHER
 * COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
 * OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
 * TRANSFERRED. 
 *
 * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE
 * AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY DIGITAL EQUIPMENT
 * CORPORATION.
 *
 * DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS
 * SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL.
 */

#ifndef _UTC_H
#define _UTC_H 1

#include <time.h>
#include <stddef.h>		/* For size_t */

#ifndef _UTC_T_
#define _UTC_T_
#include <dce/utctypes.h>
#endif /* _UTC_T_ */

enum utc_cmptype {
    utc_lessThan,
    utc_equalTo,
    utc_greaterThan,
    utc_indeterminate
};

/*  
 *  We need a definition of struct timespec, the OSF/1 AES defines it in
 *  sys/timers.h.  If using an AES compliant system include that file, 
 *  else use the definition below.  This is so utc.h and sys/timers.h 
 *  can be included in any order.
 */
#if defined(_AES_SOURCE)
#include <sys/timers.h>
#else
#ifndef _TIMESPEC_T_
#define _TIMESPEC_T_
typedef struct timespec {
    time_t tv_sec;
    long tv_nsec;
} timespec_t;
#endif	/* _TIMESPEC_T_ */
#endif  /* _AES_SOURCE */

#if !defined(_TIMESPEC_T_) && !defined(_TIMESPEC)
#define _TIMESPEC_T_
typedef struct timespec timespec_t;
#endif	/* _TIMESPEC_T_ */

#ifndef _RELTIMESPEC_T_
#define _RELTIMESPEC_T_
typedef struct reltimespec
{
    time_t	tv_sec;
    long 	tv_nsec;
} reltimespec_t;
#endif  /* _RELTIMESPEC_T_ */

#define UTC_MAX_STR_LEN	50	/* Max length of string used by conversion
				   routines (utc_asc...) */

#ifdef IBMOS2			/* CMVC 13269  - compiler support */

int DCEAPI utc_gettime(utc_t *);
int DCEAPI utc_bintime(timespec_t *, timespec_t *, long *, utc_t *);
int DCEAPI utc_mkbintime(utc_t *, timespec_t *,  timespec_t *, long );
int DCEAPI utc_binreltime(reltimespec_t *, timespec_t *, utc_t *);
int DCEAPI utc_mkbinreltime(utc_t *, reltimespec_t *, timespec_t *);
int DCEAPI utc_localtime(struct tm *, long *, struct tm *, long *, utc_t *);
int DCEAPI utc_mklocaltime(utc_t *, struct tm *, long , struct tm *, long );
int DCEAPI utc_localzone(char *, size_t , long *, int *, utc_t *);
int DCEAPI utc_anyzone(char *, size_t , long *, int *, utc_t *);
int DCEAPI utc_gmtzone(char *, size_t , long *, int *, utc_t *);
int DCEAPI utc_gmtime(struct tm *, long *, struct tm *, long *, utc_t *);
int DCEAPI utc_mkgmtime(utc_t *, struct tm *, long , struct tm *, long );
int DCEAPI utc_anytime(struct tm *, long *, struct tm *, long *, long *, utc_t *);
int DCEAPI utc_mkanytime(utc_t *, struct tm *, long , struct tm *, long , long );
int DCEAPI utc_reltime(struct tm *, long *, struct tm *, long *, utc_t *);
int DCEAPI utc_mkreltime(utc_t *, struct tm *, long , struct tm *, long );
int DCEAPI utc_abstime(utc_t *, utc_t *);
int DCEAPI utc_addtime(utc_t *, utc_t *, utc_t *);
int DCEAPI utc_subtime(utc_t *, utc_t *, utc_t *);
int DCEAPI utc_multime(utc_t *, utc_t *, long );
int DCEAPI utc_mulftime(utc_t *, utc_t *, double );
int DCEAPI utc_cmpmidtime(enum utc_cmptype *, utc_t *, utc_t *);
int DCEAPI utc_cmpintervaltime(enum utc_cmptype *, utc_t *, utc_t *);
int DCEAPI utc_boundtime(utc_t *, utc_t *, utc_t *);
int DCEAPI utc_spantime(utc_t *, utc_t *, utc_t *);
int DCEAPI utc_pointtime(utc_t *, utc_t *, utc_t *, utc_t *);
int DCEAPI utc_getusertime(utc_t *);
int DCEAPI utc_ascgmtime(char *, size_t , utc_t *);
int DCEAPI utc_asclocaltime(char *, size_t , utc_t *);
int DCEAPI utc_ascanytime(char *, size_t , utc_t *);
int DCEAPI utc_ascreltime(char *, size_t , utc_t *);
int DCEAPI utc_mkasctime(utc_t *, char *);
int DCEAPI utc_mkascreltime(utc_t *, char *);
#else
int utc_gettime(utc_t *);
int utc_bintime(timespec_t *, timespec_t *, long *, utc_t *);
int utc_mkbintime(utc_t *, timespec_t *,  timespec_t *, long );
int utc_binreltime(reltimespec_t *, timespec_t *, utc_t *);
int utc_mkbinreltime(utc_t *, reltimespec_t *, timespec_t *);
int utc_localtime(struct tm *, long *, struct tm *, long *, utc_t *);
int utc_mklocaltime(utc_t *, struct tm *, long , struct tm *, long );
int utc_localzone(char *, size_t , long *, int *, utc_t *);
int utc_anyzone(char *, size_t , long *, int *, utc_t *);
int utc_gmtzone(char *, size_t , long *, int *, utc_t *);
int utc_gmtime(struct tm *, long *, struct tm *, long *, utc_t *);
int utc_mkgmtime(utc_t *, struct tm *, long , struct tm *, long );
int utc_anytime(struct tm *, long *, struct tm *, long *, long *, utc_t *);
int utc_mkanytime(utc_t *, struct tm *, long , struct tm *, long , long );
int utc_reltime(struct tm *, long *, struct tm *, long *, utc_t *);
int utc_mkreltime(utc_t *, struct tm *, long , struct tm *, long );
int utc_abstime(utc_t *, utc_t *);
int utc_addtime(utc_t *, utc_t *, utc_t *);
int utc_subtime(utc_t *, utc_t *, utc_t *);
int utc_multime(utc_t *, utc_t *, long );
int utc_mulftime(utc_t *, utc_t *, double );
int utc_cmpmidtime(enum utc_cmptype *, utc_t *, utc_t *);
int utc_cmpintervaltime(enum utc_cmptype *, utc_t *, utc_t *);
int utc_boundtime(utc_t *, utc_t *, utc_t *);
int utc_spantime(utc_t *, utc_t *, utc_t *);
int utc_pointtime(utc_t *, utc_t *, utc_t *, utc_t *);
int utc_getusertime(utc_t *);
int utc_ascgmtime(char *, size_t , utc_t *);
int utc_asclocaltime(char *, size_t , utc_t *);
int utc_ascanytime(char *, size_t , utc_t *);
int utc_ascreltime(char *, size_t , utc_t *);
int utc_mkasctime(utc_t *, char *);
int utc_mkascreltime(utc_t *, char *);
#endif /* IBMOS2 */
#endif /* _UTC_H */
