[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[COAS-List] Re: [Time] -Forwarded



Kent Wreder wrote:
> 
> Hi Tim,
> 
> Can you explain how time is represented in COAS to the HRAC
> submitters?
> 
> Kent.

Carol wrote:
> I admit I haven't looked at the COAS time proposal yet.... 
> those of you involved in it... will it work for this?

In COAS we represent time similar to the Time Service except we use
'long long' instead of 'unsigned long long'.  

	1 LSB = 100 ns,
	0 absolute time = 15 October 1582 00:00:00 
	range of representation ~-30,000 - 30,000 years

A TimeStamp includes a time indication and an inaccuracy indication in
the same way that one of the Time Service types did.  Signed 'long long'
is used so negative relative times can be represented.

I have seen a problem in representing small times such as ECG sample
rates using this.  For example at 200 samples per second the period
would be represented as 50,000 and the round off error is 1/50,000. 
Since we could potentially monitor a person's ECG for 96 hours
continuously this round off error can be significant if used for certain
calculations (96 * 60 * 60 = 345,600 seconds; 345,600/50,000 = 6.912
seconds of error).  For this reason I have been wondering if we should
use the 'double' type for time representation.  This would give a larger
range for absolute times and higher precision for relative times.  I
have not thought thru other ramifications though.


Tim


-------------------------------------------------
//File: TimeDefs.idl

#ifndef _TIME_DEFS_IDL_
#define _TIME_DEFS_IDL_

//#include <orb.idl>

#pragma prefix "omg.org"

module DSTimeDefs {

	typedef unsigned long long TimeT;
	typedef long long SignedTimeT;

	struct TimeStamp {
		SignedTimeT time;
		TimeT inaccuracy;
	};
	typedef sequence< TimeStamp > TimeStampSeq;

	struct TimeSpan {
		SignedTimeT begin_time;
		SignedTimeT end_time;
	};
	typedef sequence< TimeSpan > TimeSpanSeq;

	typedef TimeT TimeDelta;

	/*  from the Time Service Spec:
		Time units 100 nanoseconds (10 -7 seconds)
		Base time 15 October 1582 00:00:00.
		Approximate range AD 30,000
		UTC time in this service specification always 
		refers to time in Greenwich Time Zone.
	*/

	const long long DATE_TIME_MIN = 0x8000000000000000;  // approx. -30,000
	const long long DATE_TIME_MAX = 0x7FFFFFFFFFFFFFFF; // approx. 30,000AD

};

#endif  // _TIME_DEFS_IDL_
begin:          vcard
fn:             Tim Brinson
n:              Brinson;Tim
org:            Protocol Systems, Inc.
adr:            8500 SW Creekside Place;;;Beaverton;Oregon;97008-7107;USA
email;internet: tim@protocol.com
title:          Systems Software Lead
tel;work:       503 526 4392
tel;fax:        503 526 4200
note:           <img src=http://aco.protocol.com/pids/tbrinson.jpg>
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard