//File: CosTime.idl
//Part of the Time Service
//OMG File: 02-03-08

#ifndef _COS_TIME_IDL_
#define _COS_TIME_IDL_

#ifdef _PRE_3_0_COMPILER_
#include <TimeBase.idl>
#pragma prefix "omg.org"
#else
import ::TimeBase;
#endif // _PRE_3_0_COMPILER_

module CosTime {

#ifndef _PRE_3_0_COMPILER_
	typeprefix CosTime "omg.org";
#endif // _PRE_3_0_COMPILER_

	enum TimeComparison {	
		TCEqualTo,
		TCLessThan,
		TCGreaterThan,
		TCIndeterminate
	};

	enum ComparisonType{
		IntervalC,		
		MidC		
	};

	enum OverlapType {
		OTContainer,
		OTContained,
		OTOverlap,
		OTNoOverlap
	};

	exception TimeUnavailable {};
	interface TIO;		// forward declaration
 
	interface UTO {
		readonly attribute TimeBase::TimeT			time;
		readonly attribute TimeBase::InaccuracyT	inaccuracy;
		readonly attribute TimeBase::TdfT 			tdf;
		readonly attribute TimeBase::UtcT 			utc_time;
		UTO absolute_time();
		TimeComparison compare_time(
			in	ComparisonType	comparison_type,
			in	CosTime::UTO    uto
		);
		TIO time_to_interval(
			in	CosTime::UTO	uto);
		TIO interval();
	};
	
	interface TIO {
		readonly attribute TimeBase::IntervalT 	time_interval;
		OverlapType spans (
			in	UTO			time,
			out TIO			overlap);
		OverlapType overlaps (
			in 	TIO			interval,
			out TIO			overlap);
		UTO time ();
	};

	interface TimeService {
		UTO universal_time()
			raises(TimeUnavailable);
		UTO secure_universal_time()
			raises(TimeUnavailable);
		UTO new_universal_time(
			in TimeBase::TimeT			time,
			in TimeBase::InaccuracyT	inaccuracy,
			in TimeBase::TdfT			tdf);
		UTO uto_from_utc(
			in TimeBase::UtcT			utc);
		TIO new_interval(
			in TimeBase::TimeT			lower,
			in TimeBase::TimeT			upper);
	};
};

#endif /* ifndef _COS_TIME_IDL_ */
