/**************************************************************************
*   Copyright 2000 Compaq Computer Corporation
*
*   COMPAQ Registered in U.S. Patent and Trademark Office.
*
*   Confidential computer software. Valid license from Compaq or authorized
*   sublicensor required for possession, use or copying. Consistent with
*   FAR 12.211 and 12.212, Commercial Computer Software, Computer Software
*   Documentation, and Technical Data for Commercial Items are licensed to
*   the U.S. Government under vendor's standard commercial license.
**************************************************************************/

#if !defined(_TIME_H_) && !defined(_TIME_H)
#if defined(__linux__)
#define _TIME_H
#else
#define _TIME_H_
#endif  /* __linux__  */

extern "C" {
namespace std {

#if defined(__linux__)
#include <features.h>			/* for setting __USE_BSD macro */
// #include <bits/time.h>
#define CLOCKS_PER_SEC   1000000
#elif defined(__unix__)
#include <standards.h>			/* for setting _OSF_SOURCE macro */
#include <machine/machtime.h>		/* for CLOCKS_PER_SEC */
#endif

#if defined (__linux__)
#define NULL    0
#else
#define NULL 	0L
#endif  /* __linux__ */

typedef unsigned long 	size_t;

typedef int		clock_t;

typedef int		time_t;

struct	tm {			/* see ctime(3) */
        int     tm_sec;         /* seconds after the minute [0-60] */
        int     tm_min;         /* minutes after the hour [0-59] */
        int     tm_hour;        /* hours since midnight [0-23] */
        int     tm_mday;        /* day of the month [1-31] */
        int     tm_mon;         /* months since January [0-11] */
        int     tm_year;        /* years since 1900 */
        int     tm_wday;        /* days since Sunday [0-6] */
        int     tm_yday;        /* days since January 1 [0-365] */
        int     tm_isdst;       /* Daylight Savings Time flag */
#if defined (__linux__)
# ifdef __USE_BSD
  long int tm_gmtoff;           /* Seconds east of UTC.  */
  __const char *tm_zone;        /* Timezone abbreviation.  */
# else
  long int __tm_gmtoff;         /* Seconds east of UTC.  */
  __const char *__tm_zone;      /* Timezone abbreviation.  */
# endif
#elif defined(__unix__)
# ifdef _OSF_SOURCE
  long    tm_gmtoff;
  char    *tm_zone;
# else
  long    __tm_gmtoff;
  char    *__tm_zone;
# endif
#endif
};

#ifdef _OSF_SOURCE
#define __tm_gmtoff tm_gmtoff
#define __tm_zone   tm_zone
#endif

extern clock_t 	clock (void);
extern double 	difftime (time_t , time_t );
extern time_t 	mktime (struct tm *);
extern time_t 	time (time_t *);
extern char 	*asctime (const struct tm *);
extern char 	*ctime (const time_t *);
extern struct tm *gmtime (const time_t *);
extern struct tm *localtime (const time_t *);
extern size_t 	strftime (char *, size_t , const char *,const struct tm *);

}   /* namespace std */
}   /* extern "C"    */

#endif /* _TIME_H_ */
