aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cosTime
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
committerErlang/OTP <[email protected]>2009-11-20 14:54:40 +0000
commit84adefa331c4159d432d22840663c38f155cd4c1 (patch)
treebff9a9c66adda4df2106dfd0e5c053ab182a12bd /lib/cosTime
downloadotp-84adefa331c4159d432d22840663c38f155cd4c1.tar.gz
otp-84adefa331c4159d432d22840663c38f155cd4c1.tar.bz2
otp-84adefa331c4159d432d22840663c38f155cd4c1.zip
The R13B03 release.OTP_R13B03
Diffstat (limited to 'lib/cosTime')
-rw-r--r--lib/cosTime/AUTHORS4
-rw-r--r--lib/cosTime/Makefile41
-rw-r--r--lib/cosTime/doc/html/.gitignore0
-rw-r--r--lib/cosTime/doc/man3/.gitignore0
-rw-r--r--lib/cosTime/doc/man6/.gitignore0
-rw-r--r--lib/cosTime/doc/pdf/.gitignore0
-rw-r--r--lib/cosTime/doc/src/CosTime_TIO.xml108
-rw-r--r--lib/cosTime/doc/src/CosTime_TimeService.xml103
-rw-r--r--lib/cosTime/doc/src/CosTime_UTO.xml155
-rw-r--r--lib/cosTime/doc/src/CosTimerEvent_TimerEventHandler.xml125
-rw-r--r--lib/cosTime/doc/src/CosTimerEvent_TimerEventService.xml84
-rw-r--r--lib/cosTime/doc/src/Makefile225
-rw-r--r--lib/cosTime/doc/src/book.gifbin0 -> 1081 bytes
-rw-r--r--lib/cosTime/doc/src/book.xml48
-rw-r--r--lib/cosTime/doc/src/ch_contents.xml74
-rw-r--r--lib/cosTime/doc/src/ch_example.xml112
-rw-r--r--lib/cosTime/doc/src/ch_install.xml55
-rw-r--r--lib/cosTime/doc/src/ch_introduction.xml58
-rw-r--r--lib/cosTime/doc/src/cosTime.xml174
-rw-r--r--lib/cosTime/doc/src/fascicules.xml18
-rw-r--r--lib/cosTime/doc/src/make.dep22
-rw-r--r--lib/cosTime/doc/src/notes.gifbin0 -> 2005 bytes
-rw-r--r--lib/cosTime/doc/src/notes.xml187
-rw-r--r--lib/cosTime/doc/src/part.xml39
-rw-r--r--lib/cosTime/doc/src/part_notes.xml36
-rw-r--r--lib/cosTime/doc/src/ref_man.gifbin0 -> 1530 bytes
-rw-r--r--lib/cosTime/doc/src/ref_man.xml41
-rw-r--r--lib/cosTime/doc/src/summary.html.src1
-rw-r--r--lib/cosTime/doc/src/user_guide.gifbin0 -> 1581 bytes
-rw-r--r--lib/cosTime/ebin/.gitignore0
-rw-r--r--lib/cosTime/examples/.gitignore0
-rw-r--r--lib/cosTime/include/.gitignore0
-rw-r--r--lib/cosTime/info12
-rw-r--r--lib/cosTime/priv/.gitignore0
-rw-r--r--lib/cosTime/src/CosTime.cfg6
-rw-r--r--lib/cosTime/src/CosTime.idl59
-rw-r--r--lib/cosTime/src/CosTime_TIO_impl.erl200
-rw-r--r--lib/cosTime/src/CosTime_TimeService_impl.erl180
-rw-r--r--lib/cosTime/src/CosTime_UTO_impl.erl241
-rw-r--r--lib/cosTime/src/CosTimerEvent.cfg4
-rw-r--r--lib/cosTime/src/CosTimerEvent.idl45
-rw-r--r--lib/cosTime/src/CosTimerEvent_TimerEventHandler_impl.erl304
-rw-r--r--lib/cosTime/src/CosTimerEvent_TimerEventService_impl.erl118
-rw-r--r--lib/cosTime/src/Makefile205
-rw-r--r--lib/cosTime/src/TimeBase.idl22
-rw-r--r--lib/cosTime/src/cosTime.app.src30
-rw-r--r--lib/cosTime/src/cosTime.appup.src6
-rw-r--r--lib/cosTime/src/cosTime.erl321
-rw-r--r--lib/cosTime/src/cosTimeApp.hrl76
-rw-r--r--lib/cosTime/vsn.mk9
50 files changed, 3548 insertions, 0 deletions
diff --git a/lib/cosTime/AUTHORS b/lib/cosTime/AUTHORS
new file mode 100644
index 0000000000..55d8059989
--- /dev/null
+++ b/lib/cosTime/AUTHORS
@@ -0,0 +1,4 @@
+Original Authors:
+Niclas Eklund
+
+Contributors:
diff --git a/lib/cosTime/Makefile b/lib/cosTime/Makefile
new file mode 100644
index 0000000000..b8628ac3c4
--- /dev/null
+++ b/lib/cosTime/Makefile
@@ -0,0 +1,41 @@
+#
+# %CopyrightBegin%
+#
+# Copyright Ericsson AB 2000-2009. All Rights Reserved.
+#
+# The contents of this file are subject to the Erlang Public License,
+# Version 1.1, (the "License"); you may not use this file except in
+# compliance with the License. You should have received a copy of the
+# Erlang Public License along with this software. If not, it can be
+# retrieved online at http://www.erlang.org/.
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+# the License for the specific language governing rights and limitations
+# under the License.
+#
+# %CopyrightEnd%
+#
+#
+include $(ERL_TOP)/make/target.mk
+include $(ERL_TOP)/make/$(TARGET)/otp.mk
+
+# ----------------------------------------------------
+# Application version
+# ----------------------------------------------------
+include vsn.mk
+VSN=$(COSTIME_VSN)
+
+# ----------------------------------------------------
+# Common Macros
+# ----------------------------------------------------
+# SUB_DIRECTORIES = src test examples doc/src
+# At the moment we don't have any example programs.
+SUB_DIRECTORIES = src doc/src
+
+SPECIAL_TARGETS =
+
+# ----------------------------------------------------
+# Default Subdir Targets
+# ----------------------------------------------------
+include $(ERL_TOP)/make/otp_subdir.mk
diff --git a/lib/cosTime/doc/html/.gitignore b/lib/cosTime/doc/html/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/cosTime/doc/html/.gitignore
diff --git a/lib/cosTime/doc/man3/.gitignore b/lib/cosTime/doc/man3/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/cosTime/doc/man3/.gitignore
diff --git a/lib/cosTime/doc/man6/.gitignore b/lib/cosTime/doc/man6/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/cosTime/doc/man6/.gitignore
diff --git a/lib/cosTime/doc/pdf/.gitignore b/lib/cosTime/doc/pdf/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/cosTime/doc/pdf/.gitignore
diff --git a/lib/cosTime/doc/src/CosTime_TIO.xml b/lib/cosTime/doc/src/CosTime_TIO.xml
new file mode 100644
index 0000000000..91aa34d8c8
--- /dev/null
+++ b/lib/cosTime/doc/src/CosTime_TIO.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE erlref SYSTEM "erlref.dtd">
+
+<erlref>
+ <header>
+ <copyright>
+ <year>2000</year>
+ <year>2007</year>
+ <holder>Ericsson AB, All Rights Reserved</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ The Initial Developer of the Original Code is Ericsson AB.
+ </legalnotice>
+
+ <title>CosTime_TIO</title>
+ <prepared>Niclas Eklund</prepared>
+ <responsible>Niclas Eklund</responsible>
+ <docno></docno>
+ <approved>Niclas Eklund</approved>
+ <checked></checked>
+ <date>2000-02-01</date>
+ <rev>1.0</rev>
+ </header>
+ <module>CosTime_TIO</module>
+ <modulesummary>This module implements the OMG CosTime::TIO interface.</modulesummary>
+ <description>
+ <p>To get access to the record definitions for the structures use: <br></br>
+<c>-include_lib("cosTime/include/*.hrl").</c></p>
+ </description>
+ <funcs>
+ <func>
+ <name>'_get_time_interval'(TIO) -> TimeInterval</name>
+ <fsummary>Return the interval associated with the target object</fsummary>
+ <type>
+ <v>TIO = #objref</v>
+ <v>TimeInterval = #'TimeBase_IntervalT{lower_bound, upper_bound}</v>
+ <v>lower_bound = upper_bound = ulonglong</v>
+ </type>
+ <desc>
+ <p>This operation returns the interval associated with the target object.</p>
+ </desc>
+ </func>
+ <func>
+ <name>spans(TIO, UTO) -> Reply</name>
+ <fsummary>Return an OverlapType which describe how the interval in the target object and the timerange represented by the UTO object overlap</fsummary>
+ <type>
+ <v>TIO = UTO = OtherTIO = #objref</v>
+ <v>Reply = {OverlapType, OtherTIO}</v>
+ <v>OverlapType = 'OTContainer' | 'OTContained' | 'OTOverlap' | 'OTNoOverlap'</v>
+ </type>
+ <desc>
+ <p>This operation returns a <em>OverlapType</em> depending on how the interval
+ in the target object and the timerange represented by the UTO object
+ overlap. If the OverlapType is 'OTNoOverlap' the out parameter represents
+ the gap between the two intervals. If OverlapType is one of the others, the
+ out parameter represents the overlap interval.
+ The definitions of the OverlapType's are:</p>
+ <p></p>
+ <list type="bulleted">
+ <item>'OTContainer' - target objects lower and upper limits are,
+ respectively, less or equal to and greater or equal to given object's.</item>
+ <item>'OTContained' - target objects lower and upper limits are,
+ respectively, greater or equal to and less or equal to given object's.</item>
+ <item>'OTOverlap' - target objects interval overlap given object's.</item>
+ <item>'OTNoOverlap' - target objects interval do not overlap given object's.</item>
+ </list>
+ </desc>
+ </func>
+ <func>
+ <name>overlaps(TIO, OtherTIO) -> Reply</name>
+ <fsummary>Return an OverlapType which describe how the interval in the target object and the timerange represented by the TIO object overlap</fsummary>
+ <type>
+ <v>TIO = OtherTIO = AnotherTIO = #objref</v>
+ <v>Reply = {OverlapType, AnotherTIO}</v>
+ <v>OverlapType = 'OTContainer' | 'OTContained' | 'OTOverlap' | 'OTNoOverlap'</v>
+ </type>
+ <desc>
+ <p>This operation returns a <em>OverlapType</em> depending on how the interval
+ in the target object and the timerange represented by the TIO object
+ overlap. The OverlapType's are described under spans/2.</p>
+ </desc>
+ </func>
+ <func>
+ <name>time(TIO) -> UTO</name>
+ <fsummary>Return a UTO in which the interval equals the time interval in the target object and time value is the midpoint of the interval</fsummary>
+ <type>
+ <v>TIO = UTO = #objref</v>
+ </type>
+ <desc>
+ <p>This operation returns a UTO in which the interval equals the time interval
+ in the target object and time value is the midpoint of the interval.</p>
+ </desc>
+ </func>
+ </funcs>
+
+</erlref>
+
diff --git a/lib/cosTime/doc/src/CosTime_TimeService.xml b/lib/cosTime/doc/src/CosTime_TimeService.xml
new file mode 100644
index 0000000000..9b20f24794
--- /dev/null
+++ b/lib/cosTime/doc/src/CosTime_TimeService.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE erlref SYSTEM "erlref.dtd">
+
+<erlref>
+ <header>
+ <copyright>
+ <year>2000</year>
+ <year>2007</year>
+ <holder>Ericsson AB, All Rights Reserved</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ The Initial Developer of the Original Code is Ericsson AB.
+ </legalnotice>
+
+ <title>CosTime_TimeService</title>
+ <prepared>Niclas Eklund</prepared>
+ <responsible>Niclas Eklund</responsible>
+ <docno></docno>
+ <approved>Niclas Eklund</approved>
+ <checked></checked>
+ <date>2000-02-01</date>
+ <rev>1.0</rev>
+ </header>
+ <module>CosTime_TimeService</module>
+ <modulesummary>This module implements the OMG CosTime::TimeService interface.</modulesummary>
+ <description>
+ <p>To get access to the record definitions for the structures use: <br></br>
+<c>-include_lib("cosTime/include/*.hrl").</c></p>
+ </description>
+ <funcs>
+ <func>
+ <name>universal_time(TimeService) -> Reply</name>
+ <fsummary>Return the current time and the Inaccuracy given when starting this application in a UTO</fsummary>
+ <type>
+ <v>TimeService = #objref</v>
+ <v>Reply = UTO | {'EXCEPTION", #'TimerService_TimeUnavailable'{}}</v>
+ <v>UTO = #objref</v>
+ </type>
+ <desc>
+ <p>This operation returns the current time and the Inaccuracy given
+ when starting this application in a UTO. The time base is
+ <em>15 october 1582 00:00</em>. Comparing two time objects which use
+ different time base is, by obvious reasons, pointless.</p>
+ </desc>
+ </func>
+ <func>
+ <name>new_universal_time(TimeService, Time, Inaccuracy, Tdf) -> UTO</name>
+ <fsummary>Create a new UTO object representing the time parameters given</fsummary>
+ <type>
+ <v>TimeService = UTO = #objref</v>
+ <v>Time = Inaccuracy = ulonglong()</v>
+ <v>Tdf = short()</v>
+ </type>
+ <desc>
+ <p>This operation creates a new UTO object representing the time
+ parameters given. This is the only way to create a UTO with an
+ arbitrary time from its components. This is useful when using the
+ Timer Event Service.</p>
+ </desc>
+ </func>
+ <func>
+ <name>uto_from_utc(TimeService, Utc) -> UTO</name>
+ <fsummary>Create a UTO representing the given time in Utc form</fsummary>
+ <type>
+ <v>TimeService = UTO = #objref</v>
+ <v>Utc = #'TimeBase_UtcT'{time, inacclo, inacchi, tdf}</v>
+ <v>time = ulonglong()</v>
+ <v>inacclo = ulong()</v>
+ <v>inacchi = ushort()</v>
+ <v>tdf = short()</v>
+ </type>
+ <desc>
+ <p>This operation is used to create a UTO given a time in the Utc form.</p>
+ </desc>
+ </func>
+ <func>
+ <name>new_interval(TimeService, Lower, Upper) -> TIO</name>
+ <fsummary>Create a new TIO object representing the input parameters</fsummary>
+ <type>
+ <v>TimeService = TIO = #objref</v>
+ <v>Lower = Upper = ulonglong()</v>
+ </type>
+ <desc>
+ <p>This operation is used to create a new TIO object, representing
+ the input parameters. If <em>Lower</em> is greater than Upper
+ BAD_PARAM is raised.</p>
+ </desc>
+ </func>
+ </funcs>
+
+</erlref>
+
diff --git a/lib/cosTime/doc/src/CosTime_UTO.xml b/lib/cosTime/doc/src/CosTime_UTO.xml
new file mode 100644
index 0000000000..73784e50f6
--- /dev/null
+++ b/lib/cosTime/doc/src/CosTime_UTO.xml
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE erlref SYSTEM "erlref.dtd">
+
+<erlref>
+ <header>
+ <copyright>
+ <year>2000</year>
+ <year>2007</year>
+ <holder>Ericsson AB, All Rights Reserved</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ The Initial Developer of the Original Code is Ericsson AB.
+ </legalnotice>
+
+ <title>CosTime_UTO</title>
+ <prepared>Niclas Eklund</prepared>
+ <responsible>Niclas Eklund</responsible>
+ <docno></docno>
+ <approved>Niclas Eklund</approved>
+ <checked></checked>
+ <date>2000-02-01</date>
+ <rev>1.0</rev>
+ </header>
+ <module>CosTime_UTO</module>
+ <modulesummary>This module implements the OMG CosTime::UTO interface.</modulesummary>
+ <description>
+ <p>To get access to the record definitions for the structures use: <br></br>
+<c>-include_lib("cosTime/include/*.hrl").</c></p>
+ </description>
+ <funcs>
+ <func>
+ <name>'_get_time'(UTO) -> ulonglong()</name>
+ <fsummary>Return the time associated with the target object</fsummary>
+ <type>
+ <v>UTO = #objref</v>
+ </type>
+ <desc>
+ <p>This operation returns the time associated with the target object.</p>
+ </desc>
+ </func>
+ <func>
+ <name>'_get_inaccuracy'(UTO) -> ulonglong()</name>
+ <fsummary>Return the inaccuracy associated with the target object</fsummary>
+ <type>
+ <v>UTO = #objref</v>
+ </type>
+ <desc>
+ <p>This operation returns the inaccuracy associated with the target object.</p>
+ </desc>
+ </func>
+ <func>
+ <name>'_get_tdf'(UTO) -> short()</name>
+ <fsummary>Return the time displacement factor associated with the target object</fsummary>
+ <type>
+ <v>UTO = #objref</v>
+ </type>
+ <desc>
+ <p>This operation returns the time displacement factor associated with
+ the target object.</p>
+ </desc>
+ </func>
+ <func>
+ <name>'_get_utc_time'(UTO) -> UtcT</name>
+ <fsummary>Return the data associated with the target object in Utc form</fsummary>
+ <type>
+ <v>UTO = #objref</v>
+ <v>Utc = #'TimeBase_UtcT'{time, inacclo, inacchi, tdf}</v>
+ <v>time = ulonglong()</v>
+ <v>inacclo = ulong()</v>
+ <v>inacchi = ushort()</v>
+ <v>tdf = short()</v>
+ </type>
+ <desc>
+ <p>This operation returns the data associated with the target object in
+ Utc form.</p>
+ </desc>
+ </func>
+ <func>
+ <name>absolute_time(UTO) -> OtherUTO</name>
+ <fsummary>Create a new UTO object representing the time in the target object added to current time (UTC)</fsummary>
+ <type>
+ <v>UTO = OtherUTO = #objref</v>
+ </type>
+ <desc>
+ <p>This operation create a new UTO object representing the time in the target
+ object added to current time (UTC). The time base is
+ <em>15 october 1582 00:00</em>. Comparing two time objects which use
+ different time base is, by obvious reasons, pointless.
+ Raises DATA_CONVERSION if causes an overflow. This operation is only useful
+ if the target object represents a relative time.</p>
+ </desc>
+ </func>
+ <func>
+ <name>compare_time(UTO, ComparisonType, OtherUTO) -> Reply</name>
+ <fsummary>Compare the time associated with the target object and the given UTO object</fsummary>
+ <type>
+ <v>UTO = OtherUTO = #objref</v>
+ <v>ComparisonType = 'IntervalC' | 'MidC'</v>
+ <v>Reply = 'TCEqualTo' | 'TCLessThan' | 'TCGreaterThan' | 'TCIndeterminate'</v>
+ </type>
+ <desc>
+ <p>This operation compares the time associated with the target object and the
+ given UTO object. The different <c>ComparisonType</c> are:</p>
+ <p></p>
+ <list type="bulleted">
+ <item>'MidC' - only compare the time represented by each object. Furthermore,
+ the target object is always used as the first parameter in the
+ comparison, i.e., if the target object's time is larger
+ 'TCGreaterThan' will be returned.</item>
+ <item>'IntervalC' - also takes the inaccuracy into consideration, i.e.,
+ if the two objects interval overlaps 'TCIndeterminate' is returned,
+ otherwise the as for 'MidC'.</item>
+ </list>
+ </desc>
+ </func>
+ <func>
+ <name>time_to_interval(UTO, OtherUTO) -> TIO</name>
+ <fsummary>Create a TIO representing the interval between the target object and the given UTO midpoint times</fsummary>
+ <type>
+ <v>UTO = OtherUTO = TIO = #objref</v>
+ </type>
+ <desc>
+ <p>This operation returns a TIO representing the interval between the target
+ object and the given UTO midpoint times. The inaccuracy in the objects are
+ not taken into consideration.</p>
+ </desc>
+ </func>
+ <func>
+ <name>interval(UTO) -> TIO</name>
+ <fsummary>Create a TIO object representing the error interval around the time value represented by the target object</fsummary>
+ <type>
+ <v>UTO = TIO = #objref</v>
+ </type>
+ <desc>
+ <p>This operation creates a TIO object representing the error interval
+ around the time value represented by the target object, i.e.,
+ <c>TIO.upper_bound = UTO.time+UTO.inaccuracy</c> and
+ <c>TIO.lower_bound = UTO.time-UTO.inaccuracy</c>.</p>
+ </desc>
+ </func>
+ </funcs>
+
+</erlref>
+
diff --git a/lib/cosTime/doc/src/CosTimerEvent_TimerEventHandler.xml b/lib/cosTime/doc/src/CosTimerEvent_TimerEventHandler.xml
new file mode 100644
index 0000000000..bc1ef39132
--- /dev/null
+++ b/lib/cosTime/doc/src/CosTimerEvent_TimerEventHandler.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE erlref SYSTEM "erlref.dtd">
+
+<erlref>
+ <header>
+ <copyright>
+ <year>2000</year>
+ <year>2007</year>
+ <holder>Ericsson AB, All Rights Reserved</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ The Initial Developer of the Original Code is Ericsson AB.
+ </legalnotice>
+
+ <title>CosTimerEvent_&shy;TimerEventHandler</title>
+ <shorttitle>..._TimerEventHandler</shorttitle>
+ <prepared>Niclas Eklund</prepared>
+ <responsible>Niclas Eklund</responsible>
+ <docno></docno>
+ <approved>Niclas Eklund</approved>
+ <checked></checked>
+ <date>2000-02-01</date>
+ <rev>1.0</rev>
+ </header>
+ <module>CosTimerEvent_TimerEventHandler</module>
+ <modulesummary>This module implements the OMG CosTimerEvent::TimerEventHandler interface.</modulesummary>
+ <description>
+ <p>To get access to the record definitions for the structures use: <br></br>
+<c>-include_lib("cosTime/include/*.hrl").</c></p>
+ </description>
+ <funcs>
+ <func>
+ <name>'_get_status'(TimerEventHandler) -> Reply</name>
+ <fsummary>Return the status of the target object</fsummary>
+ <type>
+ <v>TimerEventHandler = #objref</v>
+ <v>Reply = 'ESTimeSet' | 'ESTimeCleared' | 'ESTriggered' | 'ESFailedTrigger'</v>
+ </type>
+ <desc>
+ <p>This operation returns the status of the target object. </p>
+ <list type="bulleted">
+ <item>'ESTimeSet' - timer is set to trigger event(s).</item>
+ <item>'ESTimeCleared' - no time set or the timer have been reset.</item>
+ <item>'ESTriggered' - event has already been sent.</item>
+ <item>'ESFailedTrigger' - tried to, but failed, sending the event.</item>
+ </list>
+ <p>If the target object is of type 'TTPeriodic' the status value
+ 'ESTriggered' is not valid.</p>
+ </desc>
+ </func>
+ <func>
+ <name>time_set(TimerEventHandler) -> Reply</name>
+ <fsummary>Return <c>true</c>if the time has been set for an event that is yet to be triggered, <c>false</c>otherwise. The outparameter represents the current time value of the target object</fsummary>
+ <type>
+ <v>TimerEventHandler = #objref</v>
+ <v>Reply = {boolean(), UTO}</v>
+ <v>UTO = #objref</v>
+ </type>
+ <desc>
+ <p>This operation returns <c>true</c> if the time has been set for an event that
+ is yet to be triggered, <c>false</c> otherwise. The outparameter represents
+ the current time value of the target object.</p>
+ </desc>
+ </func>
+ <func>
+ <name>set_timer(TimerEventHandler, TimeType, TriggerTime) -> void()</name>
+ <fsummary>Terminate terminate any previous set trigger, and set a new trigger specified by the <c>TimeType</c>and <c>UTO</c>objects</fsummary>
+ <type>
+ <v>TimerEventHandler = #objref</v>
+ <v>TimeType = 'TTAbsolute' | 'TTRelative' | 'TTPeriodic'</v>
+ <v>TriggerTime = UTO</v>
+ <v>UTO = #objref</v>
+ </type>
+ <desc>
+ <p>This operation terminates any previous set trigger, and set a new trigger
+ specified by the <c>TimeType</c> and <c>UTO</c> objects.</p>
+ <p>The relation between the UTO object and the TimeTypes are:</p>
+ <list type="bulleted">
+ <item>'TTAbsolute' - the UTO object must represent absolute time, i.e.,
+ number of 100 nanoseconds passed since 15 october
+ 1582 00:00.</item>
+ <item>'TTRelative' - the UTO object must represent the from now until when
+ the event should be triggered, e.g., within 30*10^7 nanoseconds.</item>
+ <item>'TTPeriodic' - the same as for 'TTRelative', but this option
+ will trigger an event periodically until timer cancelled.</item>
+ </list>
+ </desc>
+ </func>
+ <func>
+ <name>cancel_timer(TimerEventHandler) -> boolean()</name>
+ <fsummary>Cancel, if possible, triggering of event(s). Return<c>true</c>if an event is actually cancelled, <c>false</c>otherwise</fsummary>
+ <type>
+ <v>TimerEventHandler = #objref</v>
+ </type>
+ <desc>
+ <p>This operation cancel, if possible, the triggering of event(s). Returns
+ <c>true</c> if an event is actually cancelled, <c>false</c> otherwise.</p>
+ </desc>
+ </func>
+ <func>
+ <name>set_data(TimerEventHandler, EventData) -> ok</name>
+ <fsummary>Change the event data sent when triggered</fsummary>
+ <type>
+ <v>TimerEventHandler = #objref</v>
+ <v>EventData = #any</v>
+ </type>
+ <desc>
+ <p>This operation changes the event data sent when triggered.</p>
+ </desc>
+ </func>
+ </funcs>
+
+</erlref>
+
diff --git a/lib/cosTime/doc/src/CosTimerEvent_TimerEventService.xml b/lib/cosTime/doc/src/CosTimerEvent_TimerEventService.xml
new file mode 100644
index 0000000000..90eeb5b2c5
--- /dev/null
+++ b/lib/cosTime/doc/src/CosTimerEvent_TimerEventService.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE erlref SYSTEM "erlref.dtd">
+
+<erlref>
+ <header>
+ <copyright>
+ <year>2000</year>
+ <year>2007</year>
+ <holder>Ericsson AB, All Rights Reserved</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ The Initial Developer of the Original Code is Ericsson AB.
+ </legalnotice>
+
+ <title>CosTimerEvent_&shy;TimerEventService</title>
+ <shorttitle>..._TimerEventService</shorttitle>
+ <prepared>Niclas Eklund</prepared>
+ <responsible>Niclas Eklund</responsible>
+ <docno></docno>
+ <approved>Niclas Eklund</approved>
+ <checked></checked>
+ <date>2000-02-01</date>
+ <rev>1.0</rev>
+ </header>
+ <module>CosTimerEvent_TimerEventService</module>
+ <modulesummary>This module implements the OMG CosTimerEvent::TimerEventService interface.</modulesummary>
+ <description>
+ <p>To get access to the record definitions for the structures use: <br></br>
+<c>-include_lib("cosTime/include/*.hrl").</c></p>
+ </description>
+ <funcs>
+ <func>
+ <name>register(TimerEventService, CosEventCommPushConsumer, Data) -> TimerEventHandler</name>
+ <fsummary>Create a new <c>TimerEventHandler</c>object which push the given<c>Data</c>to given <c>CosEventCommPushConsumer</c>after the timer have been set</fsummary>
+ <type>
+ <v>TimerEventService = CosEventCommPushConsumer = TimerEventHandler = #objref</v>
+ <v>Data = #any</v>
+ </type>
+ <desc>
+ <p>This operation will create a new <c>TimerEventHandler</c> object which
+ will push given <c>Data</c> to given <c>CosEventCommPushConsumer</c> after
+ the timer have been set.</p>
+ </desc>
+ </func>
+ <func>
+ <name>unregister(TimerEventService, TimerEventHandler) -> ok</name>
+ <fsummary>Terminate the target TimerEventHandler object</fsummary>
+ <type>
+ <v>TimerEventService = TimerEventHandler = #objref</v>
+ </type>
+ <desc>
+ <p>This operation will terminate the given TimerEventHandler.</p>
+ </desc>
+ </func>
+ <func>
+ <name>event_time(TimerEventService, TimerEvent) -> UTO</name>
+ <fsummary>Return a UTO containing the time at which the associated event was triggered</fsummary>
+ <type>
+ <v>TimerEventService = #objref</v>
+ <v>TimerEvent = #'CosTimerEvent_TimerEvent'{utc, event_data}</v>
+ <v>utc = </v>
+ <v>event_data = #any}</v>
+ <v>UTO = #objref</v>
+ </type>
+ <desc>
+ <p>This operation returns a UTO containing the time at which the associated
+ event was triggered.</p>
+ </desc>
+ </func>
+ </funcs>
+
+</erlref>
+
diff --git a/lib/cosTime/doc/src/Makefile b/lib/cosTime/doc/src/Makefile
new file mode 100644
index 0000000000..568e2cd4cc
--- /dev/null
+++ b/lib/cosTime/doc/src/Makefile
@@ -0,0 +1,225 @@
+#
+# %CopyrightBegin%
+#
+# Copyright Ericsson AB 2000-2009. All Rights Reserved.
+#
+# The contents of this file are subject to the Erlang Public License,
+# Version 1.1, (the "License"); you may not use this file except in
+# compliance with the License. You should have received a copy of the
+# Erlang Public License along with this software. If not, it can be
+# retrieved online at http://www.erlang.org/.
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+# the License for the specific language governing rights and limitations
+# under the License.
+#
+# %CopyrightEnd%
+#
+#
+include $(ERL_TOP)/make/target.mk
+include $(ERL_TOP)/make/$(TARGET)/otp.mk
+
+# ----------------------------------------------------
+# Application version
+# ----------------------------------------------------
+include ../../vsn.mk
+VSN=$(COSTIME_VSN)
+APPLICATION=cosTime
+
+# ----------------------------------------------------
+# Include dependency
+# ----------------------------------------------------
+
+ifndef DOCSUPPORT
+include make.dep
+endif
+
+# ----------------------------------------------------
+# Release directory specification
+# ----------------------------------------------------
+RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN)
+
+# ----------------------------------------------------
+# Target Specs
+# ----------------------------------------------------
+XML_APPLICATION_FILES = ref_man.xml
+XML_REF3_FILES = \
+ cosTime.xml \
+ CosTime_TIO.xml \
+ CosTime_TimeService.xml \
+ CosTime_UTO.xml \
+ CosTimerEvent_TimerEventHandler.xml \
+ CosTimerEvent_TimerEventService.xml \
+
+XML_PART_FILES = \
+ part.xml \
+ part_notes.xml
+XML_CHAPTER_FILES = \
+ ch_contents.xml \
+ ch_introduction.xml \
+ ch_install.xml \
+ ch_example.xml \
+ notes.xml
+
+BOOK_FILES = book.xml
+
+TECHNICAL_DESCR_FILES =
+
+GIF_FILES = \
+ book.gif \
+ notes.gif \
+ ref_man.gif \
+ user_guide.gif
+
+PS_FILES =
+
+# ----------------------------------------------------
+
+INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html)
+
+HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \
+ $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html)
+
+INFO_FILE = ../../info
+EXTRA_FILES = summary.html.src \
+ $(DEFAULT_GIF_FILES) \
+ $(DEFAULT_HTML_FILES) \
+ $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) \
+ $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html)
+
+MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3)
+
+ifdef DOCSUPPORT
+
+HTML_REF_MAN_FILE = $(HTMLDIR)/index.html
+
+TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf
+
+else
+
+TEX_FILES_BOOK = \
+ $(BOOK_FILES:%.xml=%.tex)
+TEX_FILES_REF_MAN = $(XML_REF3_FILES:%.xml=%.tex) \
+ $(XML_APPLICATION_FILES:%.xml=%.tex)
+TEX_FILES_USERS_GUIDE = \
+ $(XML_CHAPTER_FILES:%.xml=%.tex)
+
+TOP_PDF_FILE = $(APPLICATION)-$(VSN).pdf
+
+TOP_PS_FILE = $(APPLICATION)-$(VSN).ps
+
+$(TOP_PDF_FILE): book.dvi ../../vsn.mk
+ $(DVI2PS) $(DVIPS_FLAGS) -f $< | $(DISTILL) $(DISTILL_FLAGS) > $@
+
+$(TOP_PS_FILE): book.dvi ../../vsn.mk
+ $(DVI2PS) $(DVIPS_FLAGS) -f $< > $@
+
+endif
+
+# ----------------------------------------------------
+# FLAGS
+# ----------------------------------------------------
+XML_FLAGS +=
+DVIPS_FLAGS +=
+
+# ----------------------------------------------------
+# Targets
+# ----------------------------------------------------
+$(HTMLDIR)/%.gif: %.gif
+ $(INSTALL_DATA) $< $@
+
+ifdef DOCSUPPORT
+
+docs: pdf html man
+
+$(TOP_PDF_FILE): $(XML_FILES)
+
+pdf: $(TOP_PDF_FILE)
+
+html: gifs $(HTML_REF_MAN_FILE)
+
+clean clean_docs:
+ rm -rf $(HTMLDIR)/*
+ rm -f $(MAN3DIR)/*
+ rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo)
+ rm -f errs core *~
+
+else
+
+ifeq ($(DOCTYPE),pdf)
+docs: pdf
+else
+ifeq ($(DOCTYPE),ps)
+docs: ps
+else
+docs: html gifs man
+endif
+endif
+
+pdf: $(TOP_PDF_FILE)
+
+ps: $(TOP_PS_FILE)
+
+html: $(HTML_FILES) $(INTERNAL_HTML_FILES)
+
+clean clean_docs clean_tex:
+ rm -f $(TEX_FILES_USERS_GUIDE) $(TEX_FILES_REF_MAN) $(TEX_FILES_BOOK)
+ rm -f $(HTML_FILES) $(MAN3_FILES)
+ rm -f $(TOP_PDF_FILE) $(TOP_PS_FILE)
+ rm -f errs core *~ *xmls_output *xmls_errs $(LATEX_CLEAN)
+
+endif
+
+man: $(MAN3_FILES)
+
+gifs: $(GIF_FILES:%=$(HTMLDIR)/%)
+
+$(INDEX_TARGET): $(INDEX_SRC)
+ sed -e 's;%VSN%;$(VSN);' $(INDEX_SRC) > $(INDEX_TARGET)
+
+debug opt:
+
+# ----------------------------------------------------
+# Release Target
+# ----------------------------------------------------
+include $(ERL_TOP)/make/otp_release_targets.mk
+
+ifdef DOCSUPPORT
+
+release_docs_spec: docs
+ $(INSTALL_DIR) $(RELSYSDIR)/doc/pdf
+ $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELSYSDIR)/doc/pdf
+ $(INSTALL_DIR) $(RELSYSDIR)/doc/html
+ $(INSTALL_DATA) $(HTMLDIR)/* \
+ $(RELSYSDIR)/doc/html
+ $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR)
+ $(INSTALL_DIR) $(RELEASE_PATH)/man/man3
+ $(INSTALL_DATA) $(MAN3DIR)/* $(RELEASE_PATH)/man/man3
+else
+
+ifeq ($(DOCTYPE),pdf)
+release_docs_spec: pdf
+ $(INSTALL_DIR) $(RELEASE_PATH)/pdf
+ $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf
+else
+ifeq ($(DOCTYPE),ps)
+release_docs_spec: ps
+ $(INSTALL_DIR) $(RELEASE_PATH)/ps
+ $(INSTALL_DATA) $(TOP_PS_FILE) $(RELEASE_PATH)/ps
+else
+release_docs_spec: docs
+ $(INSTALL_DIR) $(RELSYSDIR)/doc/html
+ $(INSTALL_DATA) $(GIF_FILES) $(EXTRA_FILES) $(HTML_FILES) \
+ $(RELSYSDIR)/doc/html
+ $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR)
+ $(INSTALL_DIR) $(RELEASE_PATH)/man/man3
+ $(INSTALL_DATA) $(MAN3_FILES) $(RELEASE_PATH)/man/man3
+
+endif
+endif
+
+endif
+
+release_spec:
+
diff --git a/lib/cosTime/doc/src/book.gif b/lib/cosTime/doc/src/book.gif
new file mode 100644
index 0000000000..94b3868792
--- /dev/null
+++ b/lib/cosTime/doc/src/book.gif
Binary files differ
diff --git a/lib/cosTime/doc/src/book.xml b/lib/cosTime/doc/src/book.xml
new file mode 100644
index 0000000000..f9d27f8d0b
--- /dev/null
+++ b/lib/cosTime/doc/src/book.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE book SYSTEM "book.dtd">
+
+<book xmlns:xi="http://www.w3.org/2001/XInclude">
+ <header titlestyle="normal">
+ <copyright>
+ <year>2000</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ </legalnotice>
+
+ <title>cosTime</title>
+ <prepared>Niclas Eklund</prepared>
+ <docno></docno>
+ <date>2000-01-31</date>
+ <rev>1.0</rev>
+ </header>
+ <insidecover>
+ </insidecover>
+ <pagetext>cosTime</pagetext>
+ <preamble>
+ <contents level="2"></contents>
+ </preamble>
+ <parts lift="no">
+ <xi:include href="part.xml"/>
+ </parts>
+ <applications>
+ <xi:include href="ref_man.xml"/>
+ </applications>
+ <releasenotes>
+ <xi:include href="notes.xml"/>
+ </releasenotes>
+ <listofterms></listofterms>
+ <index></index>
+</book>
+
diff --git a/lib/cosTime/doc/src/ch_contents.xml b/lib/cosTime/doc/src/ch_contents.xml
new file mode 100644
index 0000000000..1e223f24fc
--- /dev/null
+++ b/lib/cosTime/doc/src/ch_contents.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2000</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ </legalnotice>
+
+ <title>The cosTime Application</title>
+ <prepared>Niclas Eklund</prepared>
+ <docno></docno>
+ <date>2000-01-31</date>
+ <rev>1.0</rev>
+ <file>ch_contents.xml</file>
+ </header>
+
+ <section>
+ <title>Content Overview</title>
+ <p>The cosTime documentation is divided into three sections:
+ </p>
+ <list type="bulleted">
+ <item>
+ <p>PART ONE - The User's Guide
+ <br></br>
+Description of the cosTime Application including
+ services and a small tutorial demonstrating
+ the development of a simple service.</p>
+ </item>
+ <item>
+ <p>PART TWO - Release Notes
+ <br></br>
+A concise history of cosTime.</p>
+ </item>
+ <item>
+ <p>PART THREE - The Reference Manual
+ <br></br>
+ A quick reference guide, including a
+ brief description, to all the functions available in cosTime.</p>
+ </item>
+ </list>
+ </section>
+
+ <section>
+ <title>Brief Description of the User's Guide</title>
+ <p>The User's Guide contains the following parts:</p>
+ <list type="bulleted">
+ <item>
+ <p>cosTime overview</p>
+ </item>
+ <item>
+ <p>cosTime installation</p>
+ </item>
+ <item>
+ <p>A tutorial example</p>
+ </item>
+ </list>
+ </section>
+</chapter>
+
diff --git a/lib/cosTime/doc/src/ch_example.xml b/lib/cosTime/doc/src/ch_example.xml
new file mode 100644
index 0000000000..9664331726
--- /dev/null
+++ b/lib/cosTime/doc/src/ch_example.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2000</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ </legalnotice>
+
+ <title>cosTime Examples</title>
+ <prepared>Niclas Eklund</prepared>
+ <docno></docno>
+ <date>2000-01-31</date>
+ <rev>A</rev>
+ <file>ch_example.xml</file>
+ </header>
+
+ <section>
+ <title>A Tutorial on How to Create a Simple Service</title>
+
+ <section>
+ <title>Initiate the Application</title>
+ <p>To use the complete cosTime application Time and Timer Event Services
+ must be installed. The application is then started by using
+ <c>cosTime:start()</c>. To get access to Time Service or Timer Event Service,
+ use <c>start_time_service/2</c> or <c>start_timerevent_service/1.</c></p>
+ <p>The Time Service are global, i.e., there may only exist one instance per
+ Orber domain.</p>
+ <p>The Timer Event Service is locally registered, i.e., there may only exist
+ one instance per node.</p>
+ <note>
+ <p>The Time and Timer Event Service use the time base
+ <em>15 october 1582 00:00</em>. Performing operations using other time
+ bases will not yield correct result. Furthermore, time and inaccuracy
+ must be expressed in 100 nano seconds.</p>
+ </note>
+ </section>
+
+ <section>
+ <title>How to Run Everything</title>
+ <p>Below is a short transcript on how to run cosTime. </p>
+ <code type="none">
+
+%% Start Mnesia and Orber
+mnesia:delete_schema([node()]),
+mnesia:create_schema([node()]),
+orber:install([node()]),
+mnesia:start(),
+orber:start(),
+
+%% Install Time Service in the IFR.
+cosTime:install_time(),
+
+%% Install Timer Event Service in the IFR. Which, require
+%% the Time Service and cosEvent or cosNotification
+%% application to be installed.
+cosNotification:install(),
+cosTime:install_timerevent(),
+
+%% Now start the application and necessary services.
+cosTime:start(),
+%% Tdf == Time displacement factor
+%% Inaccuracy measured in 100 nano seconds
+TS=cosTime:start_time_service(TDF, Inaccuracy),
+TES=cosTime:start_timerevent_service(TS),
+
+%% Access a cosNotification Proxy Push Consumer. How this is
+%% done is implementation specific.
+ProxyPushConsumer = ....
+
+%% How we construct the event is also implementation specific.
+AnyEvent = ....
+
+%% Create a new relative universal time.
+%% Time measured in 100 nano seconds.
+UTO='CosTime_TimeService':
+ new_universal_time(TS, Time, Inaccuracy, TDF),
+EH='CosTimerEvent_TimerEventService':
+ register(TES, ProxyPushConsumer, AnyEvent),
+
+%% If we want to trigger one event Time*10^-7 seconds from now:
+'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTRelative', UTO),
+
+%% If we want to trigger an event every Time*10^-7 seconds, starting
+%% Time*10^-7 seconds from now:
+'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTPeriodic', UTO),
+
+%% If we want to use absolute time we must retrieve such an object.
+%% One way is to convert the one we got, UTO, by using:
+UTO2='CosTime_UTO':absolute_time(UTO),
+%% If any other way is used, the correct time base MUST be used, i.e.,
+%% 15 october 1582 00:00.
+'CosTimerEvent_TimerEventHandler':set_timer(EH, 'TTAbsolute', UTO2),
+ </code>
+ </section>
+ </section>
+</chapter>
+
diff --git a/lib/cosTime/doc/src/ch_install.xml b/lib/cosTime/doc/src/ch_install.xml
new file mode 100644
index 0000000000..fe2b25c2f6
--- /dev/null
+++ b/lib/cosTime/doc/src/ch_install.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2000</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ </legalnotice>
+
+ <title>Installing cosTime</title>
+ <prepared>Niclas Eklund</prepared>
+ <docno></docno>
+ <date>2000-01-31</date>
+ <rev></rev>
+ <file>ch_install.xml</file>
+ </header>
+
+ <section>
+ <title>Installation Process </title>
+ <p>This chapter describes how to install
+ <seealso marker="cosTime">cosTime</seealso> in an Erlang Environment.
+ </p>
+
+ <section>
+ <title>Preparation</title>
+ <p>Before starting the installation process for cosTime,
+ the application Orber must be running.</p>
+ </section>
+
+ <section>
+ <title>Configuration</title>
+ <p>When using both the Time and TimerEvent Services the <c>cosTime</c> application
+ first must be installed using <c>cosTime:install_time()</c> and
+ <c>cosTime:install_timerevent()</c>, followed by <c>cosTime:start()</c>.
+ Now we can choose which can start the servers by using
+ <c>cosTime:start_time_service(Tdf, Inaccuracy)</c>
+ and <c>cosTime:start_timerevent_service(TimeService)</c>.</p>
+ </section>
+ </section>
+</chapter>
+
diff --git a/lib/cosTime/doc/src/ch_introduction.xml b/lib/cosTime/doc/src/ch_introduction.xml
new file mode 100644
index 0000000000..ca23168089
--- /dev/null
+++ b/lib/cosTime/doc/src/ch_introduction.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2000</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ </legalnotice>
+
+ <title>Introduction to cosTime</title>
+ <prepared>Niclas Eklund</prepared>
+ <docno></docno>
+ <date>2000-01-31</date>
+ <rev></rev>
+ <file>ch_introduction.xml</file>
+ </header>
+
+ <section>
+ <title>Overview</title>
+ <p>The cosTime application is Time and TimerEvent Services compliant with the <url href="http://www.omg.org">OMG</url>
+ Services CosTime and CosTimerEvent.
+ </p>
+
+ <section>
+ <title>Purpose and Dependencies</title>
+ <p>This application use <c>calender:now_to_universal_time(Now)</c> to create a
+ UTC. Hence, the underlying OS must deliver a correct result when calling
+ <c>erlang:now()</c>.</p>
+ <p><em>cosTime</em> is dependent on <em>Orber</em>, which provides CORBA functionality in an Erlang environment.</p>
+ <p><em>cosTimerEvent</em> is dependent on <em>Orber</em> and <em>cosNotification</em>,
+ which provides CORBA functionality and Event handling in an Erlang environment.</p>
+ </section>
+
+ <section>
+ <title>Prerequisites</title>
+ <p>To fully understand the concepts presented in the
+ documentation, it is recommended that the user is familiar
+ with distributed programming, CORBA, the Orber and cosNotification applications.
+ </p>
+ <p>Recommended reading includes <em>CORBA, Fundamentals and Programming - Jon Siegel</em> and <em>Open Telecom Platform Documentation Set</em>. It is also helpful to have read <em>Concurrent Programming in Erlang</em>.</p>
+ </section>
+ </section>
+</chapter>
+
diff --git a/lib/cosTime/doc/src/cosTime.xml b/lib/cosTime/doc/src/cosTime.xml
new file mode 100644
index 0000000000..8bc80f2322
--- /dev/null
+++ b/lib/cosTime/doc/src/cosTime.xml
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE erlref SYSTEM "erlref.dtd">
+
+<erlref>
+ <header>
+ <copyright>
+ <year>2000</year>
+ <year>2007</year>
+ <holder>Ericsson AB, All Rights Reserved</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ The Initial Developer of the Original Code is Ericsson AB.
+ </legalnotice>
+
+ <title>cosTime</title>
+ <prepared>Niclas Eklund</prepared>
+ <responsible>Niclas Eklund</responsible>
+ <docno></docno>
+ <approved>Niclas Eklund</approved>
+ <checked></checked>
+ <date>2000-01-31</date>
+ <rev>PA1</rev>
+ </header>
+ <module>cosTime</module>
+ <modulesummary>The main module of the cosTime application</modulesummary>
+ <description>
+ <p>To get access to the record definitions for the structures use: <br></br>
+<c>-include_lib("cosTime/include/*.hrl").</c></p>
+ <p>This module contains the functions for starting and stopping the application.</p>
+ <p>This application use the time base <em>15 october 1582 00:00</em>.
+ Performing operations using other time bases will not yield correct result.</p>
+ <p>The OMG CosTime specification defines the operation
+ <c>secure_universal_time</c>. As of today we cannot provide this functionality
+ considering the criteria demanded to fulfill the OMG specification.</p>
+ <p>When using this application, time and inaccuracy supplied by the user must
+ be given in number of <em>100 nano seconds</em>. The
+ <em>Time Displacement Factor</em> is positive east of the meridian, while
+ those to the west are negative.</p>
+ <p>This application use <c>calender:now_to_universal_time(Now)</c> to create a
+ UTC. Hence, the underlying OS must deliver a correct result when calling
+ <c>erlang:now()</c>.</p>
+ <p>When determining the inaccuracy of the system, the user should consider the
+ way the time objects will be used. Communicating with other ORB's, add a
+ substantial overhead and should be taken into consideration.</p>
+ </description>
+ <funcs>
+ <func>
+ <name>install_time() -> Return</name>
+ <fsummary>Install the cosTime Time Service part application</fsummary>
+ <type>
+ <v>Return = ok | {'EXIT', Reason}</v>
+ </type>
+ <desc>
+ <p>This operation installs the cosTime Time Service part application.</p>
+ </desc>
+ </func>
+ <func>
+ <name>uninstall_time() -> Return</name>
+ <fsummary>Uninstall the cosTime Time Service part application</fsummary>
+ <type>
+ <v>Return = ok | {'EXIT', Reason}</v>
+ </type>
+ <desc>
+ <p>This operation uninstalls the cosTime Time Service part application.</p>
+ </desc>
+ </func>
+ <func>
+ <name>install_timerevent() -> Return</name>
+ <fsummary>Install the cosTime Timer Event Service part application</fsummary>
+ <type>
+ <v>Return = ok | {'EXIT', Reason}</v>
+ </type>
+ <desc>
+ <p>This operation installs the cosTime Timer Event Service part application.</p>
+ <note>
+ <p>The Timer Event Service part requires <em>Time Service</em> part and
+ <em>cosEvent</em> or the <em>cosNotification</em> application to be installed
+ first.</p>
+ </note>
+ </desc>
+ </func>
+ <func>
+ <name>uninstall_timerevent() -> Return</name>
+ <fsummary>Uninstall the cosTime Timer Event Service part application</fsummary>
+ <type>
+ <v>Return = ok | {'EXIT', Reason}</v>
+ </type>
+ <desc>
+ <p>This operation uninstalls the cosTime Timer Event Service part application.</p>
+ </desc>
+ </func>
+ <func>
+ <name>start() -> Return</name>
+ <fsummary>Start the cosTime application</fsummary>
+ <type>
+ <v>Return = ok | {error, Reason}</v>
+ </type>
+ <desc>
+ <p>This operation starts the cosTime application.</p>
+ </desc>
+ </func>
+ <func>
+ <name>stop() -> Return</name>
+ <fsummary>Stop the cosTime application</fsummary>
+ <type>
+ <v>Return = ok | {error, Reason}</v>
+ </type>
+ <desc>
+ <p>This operation stops the cosTime application.</p>
+ </desc>
+ </func>
+ <func>
+ <name>start_time_service(Tdf, Inaccuracy) -> Return</name>
+ <fsummary>Start a Time Service object</fsummary>
+ <type>
+ <v>Tdf = short()</v>
+ <v>Inaccuracy = ulonglong(), eq. #100 nano seconds</v>
+ <v>Return = ok | {'EXCEPTION', #'BAD_PARAM'{}}</v>
+ </type>
+ <desc>
+ <p>This operation starts a Time Service server. Please note that there
+ may only be exactly one Time Service active at a time. The <c>Inaccuracy</c>
+ parameter defines the inaccuracy the underlying OS will introduce. Remember
+ to take into account latency when passing time object between nodes.</p>
+ </desc>
+ </func>
+ <func>
+ <name>stop_time_service(TimeService) -> ok</name>
+ <fsummary>Stop the target Time Service object</fsummary>
+ <type>
+ <v>TimeService = #objref</v>
+ </type>
+ <desc>
+ <p>This operation stops the Time Service object.</p>
+ </desc>
+ </func>
+ <func>
+ <name>start_timerevent_service(TimeService) -> ok</name>
+ <fsummary>Start a Timer Event Service object</fsummary>
+ <type>
+ <v>TimeService = #objref</v>
+ </type>
+ <desc>
+ <p>This operation starts a Timer Event Service server. Please note that there
+ may only be exactly one Timer Event Service per node active at a time. The
+ supplied TimeServcie reference will be the object Timer Event Service
+ contacts to get access to a new UTC.</p>
+ </desc>
+ </func>
+ <func>
+ <name>stop_timerevent_service(TimerEventService) -> ok</name>
+ <fsummary>Stop the target Timer Event Service object</fsummary>
+ <type>
+ <v>TimerEventService = #objref</v>
+ </type>
+ <desc>
+ <p>This operation stops the Timer Event Service object.</p>
+ </desc>
+ </func>
+ </funcs>
+
+</erlref>
+
diff --git a/lib/cosTime/doc/src/fascicules.xml b/lib/cosTime/doc/src/fascicules.xml
new file mode 100644
index 0000000000..0678195e07
--- /dev/null
+++ b/lib/cosTime/doc/src/fascicules.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE fascicules SYSTEM "fascicules.dtd">
+
+<fascicules>
+ <fascicule file="part" href="part_frame.html" entry="no">
+ User's Guide
+ </fascicule>
+ <fascicule file="ref_man" href="ref_man_frame.html" entry="yes">
+ Reference Manual
+ </fascicule>
+ <fascicule file="part_notes" href="part_notes_frame.html" entry="no">
+ Release Notes
+ </fascicule>
+ <fascicule file="" href="../../../../doc/print.html" entry="no">
+ Off-Print
+ </fascicule>
+</fascicules>
+
diff --git a/lib/cosTime/doc/src/make.dep b/lib/cosTime/doc/src/make.dep
new file mode 100644
index 0000000000..69a584ab95
--- /dev/null
+++ b/lib/cosTime/doc/src/make.dep
@@ -0,0 +1,22 @@
+# ----------------------------------------------------
+# >>>> Do not edit this file <<<<
+# This file was automaticly generated by
+# /home/otp/bin/docdepend
+# ----------------------------------------------------
+
+
+# ----------------------------------------------------
+# TeX files that the DVI file depend on
+# ----------------------------------------------------
+
+book.dvi: CosTime_TIO.tex CosTime_TimeService.tex CosTime_UTO.tex \
+ CosTimerEvent_TimerEventHandler.tex CosTimerEvent_TimerEventService.tex \
+ book.tex ch_contents.tex ch_example.tex ch_install.tex \
+ ch_introduction.tex cosTime.tex part.tex ref_man.tex
+
+# ----------------------------------------------------
+# Source inlined when transforming from source to LaTeX
+# ----------------------------------------------------
+
+book.tex: ref_man.xml
+
diff --git a/lib/cosTime/doc/src/notes.gif b/lib/cosTime/doc/src/notes.gif
new file mode 100644
index 0000000000..e000cca26a
--- /dev/null
+++ b/lib/cosTime/doc/src/notes.gif
Binary files differ
diff --git a/lib/cosTime/doc/src/notes.xml b/lib/cosTime/doc/src/notes.xml
new file mode 100644
index 0000000000..afa10980e8
--- /dev/null
+++ b/lib/cosTime/doc/src/notes.xml
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE chapter SYSTEM "chapter.dtd">
+
+<chapter>
+ <header>
+ <copyright>
+ <year>2000</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ </legalnotice>
+
+ <title>cosTime Release Notes</title>
+ <prepared>Niclas Eklund</prepared>
+ <responsible>Niclas Eklund</responsible>
+ <docno></docno>
+ <approved></approved>
+ <checked></checked>
+ <date>2000-01-31</date>
+ <rev>A</rev>
+ <file>notes.xml</file>
+ </header>
+
+ <section>
+ <title>cosTime 1.1.7</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>
+ The documentation is now built with open source tools (xsltproc and fop)
+ that exists on most platforms. One visible change is that the frames are removed.</p>
+ <p>
+ Own Id: OTP-8201 Aux Id:</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>cosTime 1.1.6</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>Obsolete guards, e.g. record vs is_record, has been changed
+ to avoid compiler warnings.</p>
+ <p>Own id: OTP-7987</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>cosTime 1.1.5</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>Updated file headers.</p>
+ <p>Own id: OTP-7837</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>cosTime 1.1.4</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>Documentation source included in open source releases.</p>
+ <p>Own id: OTP-7595</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>cosTime 1.1.3</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>Updated file headers.</p>
+ <p>Own id: OTP-7011</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>cosTime 1.1.2</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>The documentation source has been converted from SGML to XML.</p>
+ <p>Own id: OTP-6754</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>cosTime 1.1.1</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>Minor Makefile changes.</p>
+ <p>Own id: OTP-6701</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>cosTime 1.1</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>The stub/skeleton-files generated by IC have been improved,
+ i.e., depending on the IDL-files, reduced the size of the
+ erl- and beam-files and decreased dependencies off Orber's
+ Interface Repository. It is necessary to re-compile all IDL-files
+ and use COS-applications, including Orber, compiled with
+ IC-4.2.</p>
+ <p>Own id: OTP-4576</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>cosTime 1.0.1.1</title>
+
+ <section>
+ <title>Incompatibilities</title>
+ <list type="bulleted">
+ <item>
+ <p>An includepath in <c>CosTimerEvent.idl</c> have been
+ changed. Hence, if you include this file you should check
+ your include paths for your IDL-file(s), i.e., add
+ the path to CosEventComm.idl.</p>
+ <p>Own Id: OTP-4093</p>
+ </item>
+ </list>
+ </section>
+ </section>
+
+ <section>
+ <title>cosTime 1.0.1</title>
+
+ <section>
+ <title>Improvements and New Features</title>
+ <list type="bulleted">
+ <item>
+ <p>First release of the cosTime application.</p>
+ <p>Own Id: -</p>
+ </item>
+ </list>
+ </section>
+ </section>
+</chapter>
+
diff --git a/lib/cosTime/doc/src/part.xml b/lib/cosTime/doc/src/part.xml
new file mode 100644
index 0000000000..fe6a50c18d
--- /dev/null
+++ b/lib/cosTime/doc/src/part.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE part SYSTEM "part.dtd">
+
+<part xmlns:xi="http://www.w3.org/2001/XInclude">
+ <header>
+ <copyright>
+ <year>2000</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ </legalnotice>
+
+ <title>cosTime User's Guide</title>
+ <prepared>Niclas Eklund</prepared>
+ <docno></docno>
+ <date>2000-01-31</date>
+ <rev>1.0</rev>
+ </header>
+ <description>
+ <p>The <em>cosTime</em> application is an Erlang implementation of the OMG
+ CORBA Time and TimerEvent Services.</p>
+ </description>
+ <xi:include href="ch_contents.xml"/>
+ <xi:include href="ch_introduction.xml"/>
+ <xi:include href="ch_install.xml"/>
+ <xi:include href="ch_example.xml"/>
+</part>
+
diff --git a/lib/cosTime/doc/src/part_notes.xml b/lib/cosTime/doc/src/part_notes.xml
new file mode 100644
index 0000000000..3f45a11ea7
--- /dev/null
+++ b/lib/cosTime/doc/src/part_notes.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE part SYSTEM "part.dtd">
+
+<part xmlns:xi="http://www.w3.org/2001/XInclude">
+ <header>
+ <copyright>
+ <year>2000</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ </legalnotice>
+
+ <title>cosTime Release Notes</title>
+ <prepared>Niclas Eklund</prepared>
+ <docno></docno>
+ <date>2000-01-31</date>
+ <rev>1.0</rev>
+ </header>
+ <description>
+ <p>The cosTime Application is an Erlang implementation of the OMG
+ CORBA Time and TimerEvent Services.</p>
+ </description>
+ <xi:include href="notes.xml"/>
+</part>
+
diff --git a/lib/cosTime/doc/src/ref_man.gif b/lib/cosTime/doc/src/ref_man.gif
new file mode 100644
index 0000000000..b13c4efd53
--- /dev/null
+++ b/lib/cosTime/doc/src/ref_man.gif
Binary files differ
diff --git a/lib/cosTime/doc/src/ref_man.xml b/lib/cosTime/doc/src/ref_man.xml
new file mode 100644
index 0000000000..18de68a4c3
--- /dev/null
+++ b/lib/cosTime/doc/src/ref_man.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="latin1" ?>
+<!DOCTYPE application SYSTEM "application.dtd">
+
+<application xmlns:xi="http://www.w3.org/2001/XInclude">
+ <header>
+ <copyright>
+ <year>2000</year><year>2009</year>
+ <holder>Ericsson AB. All Rights Reserved.</holder>
+ </copyright>
+ <legalnotice>
+ The contents of this file are subject to the Erlang Public License,
+ Version 1.1, (the "License"); you may not use this file except in
+ compliance with the License. You should have received a copy of the
+ Erlang Public License along with this software. If not, it can be
+ retrieved online at http://www.erlang.org/.
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ </legalnotice>
+
+ <title>cosTime Reference Manual</title>
+ <prepared>Niclas Eklund</prepared>
+ <docno></docno>
+ <date>2000-01-31</date>
+ <rev>1.0</rev>
+ </header>
+ <description>
+ <p>The <em>cosTime</em> application is an Erlang implementation of the OMG
+ CORBA Time and TimerEvent Services.</p>
+ </description>
+ <xi:include href="cosTime.xml"/>
+ <xi:include href="CosTime_TIO.xml"/>
+ <xi:include href="CosTime_TimeService.xml"/>
+ <xi:include href="CosTime_UTO.xml"/>
+ <xi:include href="CosTimerEvent_TimerEventHandler.xml"/>
+ <xi:include href="CosTimerEvent_TimerEventService.xml"/>
+</application>
+
diff --git a/lib/cosTime/doc/src/summary.html.src b/lib/cosTime/doc/src/summary.html.src
new file mode 100644
index 0000000000..78e383d275
--- /dev/null
+++ b/lib/cosTime/doc/src/summary.html.src
@@ -0,0 +1 @@
+Orber OMG Timer and TimerEvent Services.
diff --git a/lib/cosTime/doc/src/user_guide.gif b/lib/cosTime/doc/src/user_guide.gif
new file mode 100644
index 0000000000..e6275a803d
--- /dev/null
+++ b/lib/cosTime/doc/src/user_guide.gif
Binary files differ
diff --git a/lib/cosTime/ebin/.gitignore b/lib/cosTime/ebin/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/cosTime/ebin/.gitignore
diff --git a/lib/cosTime/examples/.gitignore b/lib/cosTime/examples/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/cosTime/examples/.gitignore
diff --git a/lib/cosTime/include/.gitignore b/lib/cosTime/include/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/cosTime/include/.gitignore
diff --git a/lib/cosTime/info b/lib/cosTime/info
new file mode 100644
index 0000000000..7820f3fdaa
--- /dev/null
+++ b/lib/cosTime/info
@@ -0,0 +1,12 @@
+group: orb
+short: Orber OMG Timer and TimerEvent Services
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/cosTime/priv/.gitignore b/lib/cosTime/priv/.gitignore
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/lib/cosTime/priv/.gitignore
diff --git a/lib/cosTime/src/CosTime.cfg b/lib/cosTime/src/CosTime.cfg
new file mode 100644
index 0000000000..1aad9ebb94
--- /dev/null
+++ b/lib/cosTime/src/CosTime.cfg
@@ -0,0 +1,6 @@
+{this, "CosTime::UTO"}.
+{{handle_info, "CosTime::UTO"}, true}.
+{this, "CosTime::TIO"}.
+{{handle_info, "CosTime::TIO"}, true}.
+{this, "CosTime::TimeService"}.
+{{handle_info, "CosTime::TimeService"}, true}.
diff --git a/lib/cosTime/src/CosTime.idl b/lib/cosTime/src/CosTime.idl
new file mode 100644
index 0000000000..2bf32681c1
--- /dev/null
+++ b/lib/cosTime/src/CosTime.idl
@@ -0,0 +1,59 @@
+#ifndef _COS_TIME_IDL_
+#define _COS_TIME_IDL_
+
+#pragma prefix "omg.org"
+
+#include<TimeBase.idl>
+
+module CosTime {
+ 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 UTO uto );
+ TIO time_to_interval( in 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
diff --git a/lib/cosTime/src/CosTime_TIO_impl.erl b/lib/cosTime/src/CosTime_TIO_impl.erl
new file mode 100644
index 0000000000..d6d4ee894b
--- /dev/null
+++ b/lib/cosTime/src/CosTime_TIO_impl.erl
@@ -0,0 +1,200 @@
+%%--------------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%----------------------------------------------------------------------
+%% File : CosTime_TIO_impl.erl
+%% Purpose :
+%%----------------------------------------------------------------------
+
+-module('CosTime_TIO_impl').
+
+%%--------------- INCLUDES -----------------------------------
+-include("cosTimeApp.hrl").
+
+%%--------------- EXPORTS ------------------------------------
+%%--------------- External -----------------------------------
+%% Attributes (external)
+-export(['_get_time_interval'/2]).
+
+%% Interface functions
+-export([spans/3, overlaps/3, time/2]).
+
+%%--------------- gen_server specific exports ----------------
+-export([handle_info/2, code_change/3]).
+-export([init/1, terminate/2]).
+
+
+%% Data structures
+-record(state, {interval,
+ tdf,
+ timer}).
+%% Data structures constructors
+-define(get_InitState(I,T,TO),
+ #state{interval = I,
+ tdf = T,
+ timer = TO}).
+
+%% Data structures selectors
+-define(get_IntervalT(S), S#state.interval).
+-define(get_Lower(S), (S#state.interval)#'TimeBase_IntervalT'.lower_bound).
+-define(get_Upper(S), (S#state.interval)#'TimeBase_IntervalT'.upper_bound).
+-define(get_Tdf(S), S#state.tdf).
+-define(get_TimerObj(S), S#state.timer).
+
+%%-----------------------------------------------------------%
+%% function : handle_info, code_change
+%% Arguments:
+%% Returns :
+%% Effect : Functions demanded by the gen_server module.
+%%------------------------------------------------------------
+
+code_change(_OldVsn, State, _Extra) ->
+ {ok, State}.
+handle_info(_Info, State) ->
+ {noreply, State}.
+
+%%----------------------------------------------------------%
+%% function : init, terminate
+%% Arguments:
+%%-----------------------------------------------------------
+
+init([Interval, Tdf, Timer]) ->
+ {ok, ?get_InitState(Interval, Tdf, Timer)}.
+
+terminate(_Reason, _State) ->
+ ok.
+
+%%-----------------------------------------------------------
+%%------------------------ attributes -----------------------
+%%-----------------------------------------------------------
+%%----------------------------------------------------------%
+%% Attribute: '_get_time_interval'
+%% Type : readonly
+%% Returns :
+%%-----------------------------------------------------------
+'_get_time_interval'(_OE_THIS, State) ->
+ {reply, ?get_IntervalT(State), State}.
+
+%%-----------------------------------------------------------
+%%------- Exported external functions -----------------------
+%%-----------------------------------------------------------
+%%----------------------------------------------------------%
+%% function : spans
+%% Arguments: Time - UTO
+%% Returns : CosTime::OverLapType - enum()
+%% TIO - out-parameter.
+%%-----------------------------------------------------------
+spans(_OE_THIS, State, Time) ->
+ ?time_TypeCheck(Time, 'CosTime_UTO'),
+ case catch 'CosTime_UTO':'_get_utc_time'(Time) of
+ #'TimeBase_UtcT'{time = Btime, inacclo = InaccL, inacchi=InaccH} ->
+ Inaccuarcy = ?concat_TimeT(InaccH, InaccL),
+ BL = Btime - Inaccuarcy,
+ BU = Btime + Inaccuarcy,
+ L = ?get_Lower(State),
+ U = ?get_Upper(State),
+ {Type, NewL, NewU} =
+ if
+ L=<BL, U>=BU ->
+ {'OTContainer',BL,BU};
+ L>=BL, U=<BU ->
+ {'OTContained',L,U};
+ L<BL, U=<BU, U>=BL ->
+ {'OTOverlap',BL,U};
+ L>=BL, L=<BU, U>BU ->
+ {'OTOverlap',L,BU};
+ L>BU ->
+ {'OTNoOverlap',BU,L};
+ true ->
+ {'OTNoOverlap',U,BL}
+ end,
+ {reply,
+ {Type,
+ 'CosTime_TIO':oe_create([#'TimeBase_IntervalT'{lower_bound=NewL,
+ upper_bound=NewU},
+ ?get_Tdf(State),
+ ?get_TimerObj(State)],
+ [{pseudo,true}|?CREATE_OPTS])},
+ State};
+ _ ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO})
+ end.
+
+
+%%----------------------------------------------------------%
+%% function : overlaps
+%% Arguments: Interval - TIO
+%% Returns : CosTime::OverLapType - enum()
+%% TIO - out-parameter.
+%%-----------------------------------------------------------
+overlaps(_OE_THIS, State, Interval) ->
+ ?time_TypeCheck(Interval, 'CosTime_TIO'),
+ case catch 'CosTime_TIO':'_get_time_interval'(Interval) of
+ #'TimeBase_IntervalT'{lower_bound=BL, upper_bound=BU} ->
+ L = ?get_Lower(State),
+ U = ?get_Upper(State),
+ {Type, NewL, NewU} =
+ if
+ L=<BL, U>=BU ->
+ {'OTContainer',BL,BU};
+ L>=BL, U=<BU ->
+ {'OTContained',L,U};
+ L<BL, U=<BU, U>=BL ->
+ {'OTOverlap',BL,U};
+ L>=BL, L=<BU, U>BU ->
+ {'OTOverlap',L,BU};
+ L>BU ->
+ {'OTNoOverlap',BU,L};
+ true ->
+ {'OTNoOverlap',U,BL}
+ end,
+ {reply,
+ {Type,
+ 'CosTime_TIO':oe_create([#'TimeBase_IntervalT'{lower_bound=NewL,
+ upper_bound=NewU},
+ ?get_Tdf(State),
+ ?get_TimerObj(State)],
+ [{pseudo,true}|?CREATE_OPTS])},
+ State};
+ _ ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO})
+ end.
+
+%%----------------------------------------------------------%
+%% function : time
+%% Arguments: -
+%% Returns : UTO
+%%-----------------------------------------------------------
+time(_OE_THIS, State) ->
+ L = ?get_Lower(State),
+ H = ?get_Upper(State),
+ Utc = #'TimeBase_UtcT'{time=(erlang:trunc(((H-L)/2))+L),
+ inacclo=L,
+ inacchi=H,
+ tdf=?get_Tdf(State)},
+ {reply,
+ 'CosTime_UTO':oe_create([Utc, ?get_TimerObj(State)], [{pseudo,true}|?CREATE_OPTS]),
+ State}.
+
+
+%%--------------- LOCAL FUNCTIONS ----------------------------
+
+%%--------------- MISC FUNCTIONS, E.G. DEBUGGING -------------
+%%--------------- END OF MODULE ------------------------------
diff --git a/lib/cosTime/src/CosTime_TimeService_impl.erl b/lib/cosTime/src/CosTime_TimeService_impl.erl
new file mode 100644
index 0000000000..bac4ae087c
--- /dev/null
+++ b/lib/cosTime/src/CosTime_TimeService_impl.erl
@@ -0,0 +1,180 @@
+%%--------------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%----------------------------------------------------------------------
+%% File : CosTime_TimeService_impl.erl
+%% Purpose :
+%%----------------------------------------------------------------------
+
+-module('CosTime_TimeService_impl').
+
+%%--------------- INCLUDES -----------------------------------
+-include("cosTimeApp.hrl").
+
+%%--------------- EXPORTS ------------------------------------
+%%--------------- External -----------------------------------
+%% Interface functions
+-export([universal_time/2, secure_universal_time/2, new_universal_time/5]).
+-export([uto_from_utc/3, new_interval/4]).
+
+%%--------------- gen_server specific exports ----------------
+-export([handle_info/2, code_change/3]).
+-export([init/1, terminate/2]).
+
+
+%% Data structures
+-record(state,
+ {tdf,
+ inaccuracy}).
+%% Data structures constructors
+-define(get_InitState(T,I),
+ #state{tdf = T,
+ inaccuracy = I}).
+
+%% Data structures selectors
+-define(get_Inaccuracy(S), S#state.inaccuracy).
+-define(get_Tdf(S), S#state.tdf).
+
+%% Data structures modifiers
+
+%% MISC
+
+%%-----------------------------------------------------------%
+%% function : handle_info, code_change
+%% Arguments:
+%% Returns :
+%% Effect : Functions demanded by the gen_server module.
+%%------------------------------------------------------------
+
+code_change(_OldVsn, State, _Extra) ->
+ {ok, State}.
+
+handle_info(_Info, State) ->
+ ?debug_print("INFO: ~p~n", [_Info]),
+ {noreply, State}.
+
+%%----------------------------------------------------------%
+%% function : init, terminate
+%% Arguments:
+%%-----------------------------------------------------------
+
+init([Tdf, Inaccuracy]) ->
+ process_flag(trap_exit, true),
+ {ok, ?get_InitState(Tdf, Inaccuracy)}.
+
+terminate(_Reason, _State) ->
+ ok.
+
+%%-----------------------------------------------------------
+%%------- Exported external functions -----------------------
+%%-----------------------------------------------------------
+%%----------------------------------------------------------%
+%% function : universal_time
+%% Arguments: -
+%% Returns : CosTime::UTO |
+%% {'EXCEPTION", #'CosTime_TimeUnavailable'{}}
+%% NOTE : cosTime:create_universal_time will raise the correct
+%% exception.
+%%-----------------------------------------------------------
+universal_time(OE_THIS, State) ->
+ {ok, Time} = create_universal_time(),
+ Inaccuracy = ?get_Inaccuracy(State),
+ Utc = #'TimeBase_UtcT'{time=Time, inacclo = ?low_TimeT(Inaccuracy),
+ inacchi = ?high_TimeT(Inaccuracy),
+ tdf = ?get_Tdf(State)},
+ {reply, 'CosTime_UTO':oe_create([Utc, OE_THIS], [{pseudo,true}|?CREATE_OPTS]), State}.
+
+%%----------------------------------------------------------%
+%% function : secure_universal_time
+%% Arguments:
+%% Returns : {'EXCEPTION", #'CosTime_TimeUnavailable'{}}
+%%-----------------------------------------------------------
+secure_universal_time(_OE_THIS, _State) ->
+ corba:raise(#'CosTime_TimeUnavailable'{}).
+
+%%----------------------------------------------------------%
+%% function : new_universal_time
+%% Arguments: Time - TimeBase::TimeT
+%% Inaccuracy - TimeBase::InaccuracyT inaccuracy
+%% Tdf - TimeBase::TdfT
+%% Returns : CosTime::UTO
+%%-----------------------------------------------------------
+new_universal_time(OE_THIS, State, Time, Inaccuracy, Tdf) when
+ is_integer(Time) andalso is_integer(Inaccuracy) andalso is_integer(Tdf) andalso
+ Tdf=<12 andalso Inaccuracy=<?max_Inaccuracy andalso Time=<?max_TimeT ->
+ Utc = #'TimeBase_UtcT'{time=Time, inacclo = ?low_TimeT(Inaccuracy),
+ inacchi = ?high_TimeT(Inaccuracy), tdf = Tdf},
+ {reply, 'CosTime_UTO':oe_create([Utc, OE_THIS], [{pseudo,true}|?CREATE_OPTS]), State};
+new_universal_time(_, _, _, _, _) ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}).
+
+%%----------------------------------------------------------%
+%% function : uto_from_utc
+%% Arguments: Utc - TimeBase::UtcT
+%% Returns : CosTime::UTO
+%%-----------------------------------------------------------
+uto_from_utc(OE_THIS, State, Utc) when is_record(Utc, 'TimeBase_UtcT') ->
+ {reply, 'CosTime_UTO':oe_create([Utc, OE_THIS],[{pseudo,true}|?CREATE_OPTS]),State};
+uto_from_utc(_, _, _) ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}).
+
+%%----------------------------------------------------------%
+%% function : new_interval
+%% Arguments: Lower - TimeBase::TimeT
+%% Upper - TimeBase::TimeT
+%% Returns : CosTime::TIO
+%%-----------------------------------------------------------
+new_interval(OE_THIS, State, Lower, Upper) when is_integer(Lower) andalso is_integer(Upper) andalso
+ Lower=<Upper ->
+ {reply, 'CosTime_TIO':oe_create([#'TimeBase_IntervalT'{lower_bound=Lower,
+ upper_bound=Upper},
+ ?get_Tdf(State),
+ OE_THIS],
+ [{pseudo,true}|?CREATE_OPTS]), State};
+new_interval(_, _, _, _) ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}).
+
+
+%%--------------- LOCAL FUNCTIONS ----------------------------
+%%-----------------------------------------------------------%
+%% function : create_universal_utc
+%% Arguments: -
+%% Returns : TimeT or raises exception.
+%% Effect : Creates a universal time; if time unavailable we
+%% must raise CosTime_TimeUnavailable.
+%% NOTE : 'datetime_to_gregorian_seconds' use year 0 as time
+%% base. We want to use 15 october 1582, 00:00 as base.
+%%------------------------------------------------------------
+
+create_universal_time() ->
+ %% Time is supposed to be #100 nano-secs passed.
+ %% We add micro secs for a greater precision.
+ {MS,S,US} = now(),
+ case catch calendar:datetime_to_gregorian_seconds(
+ calendar:now_to_universal_time({MS,S,US})) of
+ Secs when is_integer(Secs) ->
+ {ok, (Secs-?ABSOLUTE_TIME_DIFF)*10000000 + US*10};
+ _ ->
+ corba:raise(#'CosTime_TimeUnavailable'{})
+ end.
+
+%%--------------- MISC FUNCTIONS, E.G. DEBUGGING -------------
+%%--------------- END OF MODULE ------------------------------
+
diff --git a/lib/cosTime/src/CosTime_UTO_impl.erl b/lib/cosTime/src/CosTime_UTO_impl.erl
new file mode 100644
index 0000000000..b35e215e90
--- /dev/null
+++ b/lib/cosTime/src/CosTime_UTO_impl.erl
@@ -0,0 +1,241 @@
+%%--------------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%----------------------------------------------------------------------
+%% File : CosTime_UTO_impl.erl
+%% Purpose :
+%%----------------------------------------------------------------------
+
+-module('CosTime_UTO_impl').
+
+%%--------------- INCLUDES -----------------------------------
+-include("cosTimeApp.hrl").
+
+
+%%--------------- EXPORTS ------------------------------------
+%%--------------- External -----------------------------------
+%% Attributes (external)
+-export(['_get_time'/2,
+ '_get_inaccuracy'/2,
+ '_get_tdf'/2,
+ '_get_utc_time'/2]).
+
+%% Interface functions
+-export([absolute_time/2, compare_time/4]).
+-export([time_to_interval/3, interval/2]).
+
+%%--------------- gen_server specific exports ----------------
+-export([handle_info/2, code_change/3]).
+-export([init/1, terminate/2]).
+
+
+%% Data structures
+-record(state, {timer, utc}).
+%% Data structures constructors
+-define(get_InitState(U, T), #state{timer = T, utc = U}).
+
+%% Data structures selectors
+-define(get_Time(S), (S#state.utc)#'TimeBase_UtcT'.time).
+-define(get_Inaccuracy(S), ?concat_TimeT((S#state.utc)#'TimeBase_UtcT'.inacchi,
+ (S#state.utc)#'TimeBase_UtcT'.inacclo)).
+-define(get_Tdf(S), (S#state.utc)#'TimeBase_UtcT'.tdf).
+-define(get_Utc(S), S#state.utc).
+-define(get_TimeObj(S), S#state.timer).
+
+
+%%-----------------------------------------------------------%
+%% function : handle_info, code_change
+%% Arguments:
+%% Returns :
+%% Effect : Functions demanded by the gen_server module.
+%%------------------------------------------------------------
+
+code_change(_OldVsn, State, _Extra) ->
+ {ok, State}.
+handle_info(_Info, State) ->
+ {noreply, State}.
+
+%%----------------------------------------------------------%
+%% function : init, terminate
+%% Arguments:
+%%-----------------------------------------------------------
+
+init([Utc, TimeObj]) ->
+ {ok, ?get_InitState(Utc, TimeObj)}.
+
+terminate(_Reason, _State) ->
+ ok.
+
+%%-----------------------------------------------------------
+%%------------------------ attributes -----------------------
+%%-----------------------------------------------------------
+%%----------------------------------------------------------%
+%% Attribute: '_get_time'
+%% Type : readonly
+%% Returns :
+%%-----------------------------------------------------------
+'_get_time'(_OE_THIS, State) ->
+ {reply, ?get_Time(State), State}.
+
+%%----------------------------------------------------------%
+%% Attribute: '_get_inaccuracy'
+%% Type : readonly
+%% Returns :
+%%-----------------------------------------------------------
+'_get_inaccuracy'(_OE_THIS, State) ->
+ {reply, ?get_Inaccuracy(State), State}.
+
+%%----------------------------------------------------------%
+%% Attribute: '_get_tdf'
+%% Type : readonly
+%% Returns :
+%%-----------------------------------------------------------
+'_get_tdf'(_OE_THIS, State) ->
+ {reply, ?get_Tdf(State), State}.
+
+%%----------------------------------------------------------%
+%% Attribute: '_get_utc_time'
+%% Type : readonly
+%% Returns :
+%%-----------------------------------------------------------
+'_get_utc_time'(_OE_THIS, State) ->
+ {reply, ?get_Utc(State), State}.
+
+%%-----------------------------------------------------------
+%%------- Exported external functions -----------------------
+%%-----------------------------------------------------------
+%%----------------------------------------------------------%
+%% function : absolute_time
+%% Arguments: -
+%% Returns : UTO
+%% NOTE : Return the base time to the relative time in the object.
+%%-----------------------------------------------------------
+absolute_time(_OE_THIS, State) ->
+ case catch 'CosTime_UTO':'_get_time'(
+ 'CosTime_TimeService':universal_time(?get_TimeObj(State)))+
+ ?get_Time(State) of
+ UniTime when is_integer(UniTime) andalso UniTime =< ?max_TimeT ->
+ Utc=?get_Utc(State),
+ {reply, 'CosTime_UTO':oe_create([Utc#'TimeBase_UtcT'{time=UniTime},
+ ?get_TimeObj(State)],
+ [{pseudo,true}|?CREATE_OPTS]), State};
+ UniTime when is_integer(UniTime) ->
+ %% Oopss, overflow!
+ corba:raise(#'DATA_CONVERSION'{completion_status=?COMPLETED_NO});
+ _ ->
+ corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO})
+ end.
+
+%%----------------------------------------------------------%
+%% function : compare_time
+%% Arguments: Comparison_type - CosTime::ComparisonType
+%% Uto - ObjRef
+%% Returns : TimeComparison - 'TCEqualTo' | 'TCLessThan' |
+%% 'TCGreaterThan' | 'TCIndeterminate'
+%%-----------------------------------------------------------
+compare_time(_OE_THIS, State, 'IntervalC', Uto) ->
+ ?time_TypeCheck(Uto, 'CosTime_UTO'),
+ case catch {'CosTime_UTO':'_get_time'(Uto),
+ 'CosTime_UTO':'_get_inaccuracy'(Uto)} of
+ {Time,Inaccuracy} when is_integer(Time) andalso is_integer(Inaccuracy) ->
+ OwnInacc = ?get_Inaccuracy(State),
+ if
+ ?get_Time(State)+OwnInacc < Time-Inaccuracy ->
+ {reply, 'TCLessThan', State};
+ ?get_Time(State)-OwnInacc > Time+Inaccuracy ->
+ {reply, 'TCGreaterThan', State};
+ ?get_Time(State) == Time, Inaccuracy==0, OwnInacc==0 ->
+ %% TimeService specification (july 1997, p14-7:2) states
+ %% that they are only equal if both UTO's Inaccuracy
+ %% equals zero.
+ {reply, 'TCEqualTo', State};
+ true ->
+ {reply, 'TCIndeterminate', State}
+ end;
+ _ ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO})
+ end;
+compare_time(_OE_THIS, State, 'MidC', Uto) ->
+ ?time_TypeCheck(Uto, 'CosTime_UTO'),
+ case catch 'CosTime_UTO':'_get_time'(Uto) of
+ Time when is_integer(Time) ->
+ if
+ ?get_Time(State) < Time ->
+ {reply, 'TCLessThan', State};
+ ?get_Time(State) > Time ->
+ {reply, 'TCGreaterThan', State};
+ true ->
+ {reply, 'TCEqualTo', State}
+ end;
+ _ ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO})
+ end;
+compare_time(_OE_THIS, _State, _, _) ->
+ %% Comparison_type given not correct?!
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}).
+
+%%----------------------------------------------------------%
+%% function : time_to_interval
+%% Arguments:
+%% Returns : TIO
+%%-----------------------------------------------------------
+time_to_interval(_OE_THIS, State, Uto) ->
+ ?time_TypeCheck(Uto, 'CosTime_UTO'),
+ case catch 'CosTime_UTO':'_get_time'(Uto) of
+ Time when is_integer(Time) ->
+ OwnTime = ?get_Time(State),
+ if
+ Time > OwnTime ->
+ {reply, 'CosTime_TIO':oe_create([#'TimeBase_IntervalT'{lower_bound=OwnTime,
+ upper_bound=Time},
+ ?get_Tdf(State),
+ ?get_TimeObj(State)],
+ [{pseudo,true}|?CREATE_OPTS]), State};
+ true ->
+ {reply, 'CosTime_TIO':oe_create([#'TimeBase_IntervalT'{lower_bound=Time,
+ upper_bound=OwnTime},
+ ?get_Tdf(State),
+ ?get_TimeObj(State)],
+ [{pseudo,true}|?CREATE_OPTS]), State}
+ end;
+ _ ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO})
+ end.
+
+%%----------------------------------------------------------%
+%% function : interval
+%% Arguments:
+%% Returns : TIO
+%%-----------------------------------------------------------
+interval(_OE_THIS, State) ->
+ Lower = ?get_Time(State) - ?get_Inaccuracy(State),
+ Upper = ?get_Time(State) + ?get_Inaccuracy(State),
+ {reply, 'CosTime_TIO':oe_create([#'TimeBase_IntervalT'{lower_bound=Lower,
+ upper_bound=Upper},
+ ?get_Tdf(State),
+ ?get_TimeObj(State)],
+ [{pseudo,true}|?CREATE_OPTS]), State}.
+
+
+%%--------------- LOCAL FUNCTIONS ----------------------------
+
+%%--------------- MISC FUNCTIONS, E.G. DEBUGGING -------------
+%%--------------- END OF MODULE ------------------------------
+
diff --git a/lib/cosTime/src/CosTimerEvent.cfg b/lib/cosTime/src/CosTimerEvent.cfg
new file mode 100644
index 0000000000..7f16197168
--- /dev/null
+++ b/lib/cosTime/src/CosTimerEvent.cfg
@@ -0,0 +1,4 @@
+{this, "CosTimerEvent::TimerEventHandler"}.
+{{handle_info, "CosTimerEvent::TimerEventHandler"}, true}.
+{this, "CosTimerEvent::TimerEventService"}.
+{{handle_info, "CosTimerEvent::TimerEventService"}, true}.
diff --git a/lib/cosTime/src/CosTimerEvent.idl b/lib/cosTime/src/CosTimerEvent.idl
new file mode 100644
index 0000000000..b845862f98
--- /dev/null
+++ b/lib/cosTime/src/CosTimerEvent.idl
@@ -0,0 +1,45 @@
+#ifndef _COS_TIMEREVENT_IDL_
+#define _COS_TIMEREVENT_IDL_
+
+#pragma prefix "omg.org"
+
+#include"CosEventComm.idl"
+#include<CosTime.idl>
+#include<TimeBase.idl>
+
+module CosTimerEvent{
+
+ enum TimeType {
+ TTAbsolute,
+ TTRelative,
+ TTPeriodic
+ };
+ enum EventStatus {
+ ESTimeSet,
+ ESTimeCleared,
+ ESTriggered,
+ ESFailedTrigger
+ };
+
+ struct TimerEventT {
+ TimeBase::UtcT utc;
+ any event_data;
+ };
+
+ interface TimerEventHandler {
+ readonly attribute EventStatus status;
+ boolean time_set( out CosTime::UTO uto );
+ void set_timer( in TimeType time_type, in CosTime::UTO trigger_time );
+ boolean cancel_timer();
+ void set_data( in any event_data );
+ };
+
+ interface TimerEventService {
+
+ TimerEventHandler register( in CosEventComm::PushConsumer event_interface, in any data );
+ void unregister( in TimerEventHandler timer_event_handler );
+ CosTime::UTO event_time( in TimerEventT timer_event );
+ };
+};
+
+#endif
diff --git a/lib/cosTime/src/CosTimerEvent_TimerEventHandler_impl.erl b/lib/cosTime/src/CosTimerEvent_TimerEventHandler_impl.erl
new file mode 100644
index 0000000000..5885691e87
--- /dev/null
+++ b/lib/cosTime/src/CosTimerEvent_TimerEventHandler_impl.erl
@@ -0,0 +1,304 @@
+%%--------------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%----------------------------------------------------------------------
+%% File : CosTimerEvent_TimerEventHandler_impl.erl
+%% Purpose :
+%%----------------------------------------------------------------------
+
+-module('CosTimerEvent_TimerEventHandler_impl').
+
+%%--------------- INCLUDES -----------------------------------
+-include("cosTimeApp.hrl").
+
+
+%%--------------- EXPORTS ------------------------------------
+%%--------------- External -----------------------------------
+%% Attributes (external)
+-export(['_get_status'/2]).
+%% Interface functions
+-export([time_set/2, set_timer/4]).
+-export([cancel_timer/2, set_data/3]).
+
+%%--------------- gen_server specific exports ----------------
+-export([handle_info/2, code_change/3]).
+-export([init/1, terminate/2]).
+
+
+%% Data structures
+-record(state, {parent,
+ parentPid,
+ event,
+ status = 'ESTimeCleared',
+ timer,
+ time,
+ timeObj,
+ myType,
+ pushConsumer,
+ uto}).
+%% Data structures constructors
+-define(get_InitState(P,PP,E,PC,TO),
+ #state{parent=P,
+ parentPid=PP,
+ event=E,
+ pushConsumer=PC,
+ timeObj=TO}).
+
+%% Data structures selectors
+-define(get_Status(S), S#state.status).
+-define(get_ParentPid(S), S#state.parentPid).
+-define(get_Parent(S), S#state.parent).
+-define(get_Event(S), S#state.event).
+-define(get_Timer(S), S#state.timer).
+-define(get_Time(S), S#state.time).
+-define(get_TimeObj(S), S#state.timeObj).
+-define(get_MyType(S), S#state.myType).
+-define(get_PushConsumer(S), S#state.pushConsumer).
+-define(get_Uto(S), S#state.uto).
+
+%% Data structures modifiers
+-define(set_Status(S,V), S#state{status=V}).
+-define(set_ParentPid(S,PP), S#state{parentPid=PP}).
+-define(set_Parent(S,P), S#state{parent=P}).
+-define(set_Event(S,E), S#state{event=E}).
+-define(set_Timer(S,T), S#state{timer=T}).
+-define(set_Time(S,T), S#state{time=T}).
+-define(set_MyType(S,Ty), S#state{myType=Ty}).
+-define(set_PushConsumer(S,P), S#state{pushConsumer=P}).
+-define(set_Uto(S,U,Type), S#state{uto=U, myType=Type}).
+-define(set_TimeData(S,U,Ty,Ti),S#state{uto=U, myType=Ty, time=Ti}).
+
+%% MISC
+-define(not_Cancelled(S), S#state.status =/= 'ESTimeCleared').
+-define(is_TimeSet(S), S#state.status == 'ESTimeSet').
+-define(is_UtoSet(S), S#state.uto =/= undefined).
+-define(is_NotAbsolute(S), S#state.myType =/= 'TTAbsolute').
+
+%%-----------------------------------------------------------%
+%% function : handle_info, code_change
+%% Arguments:
+%% Returns :
+%% Effect : Functions demanded by the gen_server module.
+%%------------------------------------------------------------
+
+code_change(_OldVsn, State, _Extra) ->
+ {ok, State}.
+
+handle_info(Info, State) ->
+ ?debug_print("INFO: ~p~n", [Info]),
+ case Info of
+ {'EXIT', Pid, _Reason} when Pid == ?get_ParentPid(State) ->
+ ?debug_print("PARENT TERMINATED with reason: ~p~n",[_Reason]),
+ {noreply, State};
+ oe_event when ?not_Cancelled(State) ->
+ %% Push event
+ case catch 'CosEventComm_PushConsumer':push(?get_PushConsumer(State),
+ ?get_Event(State)) of
+ ok ->
+ ?debug_print("PUSHED: ~p~n", [?get_Event(State)]),
+ {noreply, ?set_Status(State, 'ESTriggered')};
+ _Other->
+ ?debug_print("FAILED PUSH: ~p ~p~n", [?get_Event(State), _Other]),
+ {noreply, ?set_Status(State, 'ESFailedTrigger')}
+ end;
+ oe_periodic_event when ?not_Cancelled(State) ->
+ %% Push event
+ catch 'CosEventComm_PushConsumer':push(?get_PushConsumer(State),
+ ?get_Event(State)),
+ {noreply, State};
+ _ ->
+ {noreply, State}
+ end.
+
+%%----------------------------------------------------------%
+%% function : init, terminate
+%% Arguments:
+%%-----------------------------------------------------------
+
+init([Parent, ParentPid, PushConsumer, Event, TimeObj]) ->
+ process_flag(trap_exit, true),
+ {ok, ?get_InitState(Parent, ParentPid, Event, PushConsumer, TimeObj)}.
+
+terminate(_Reason, State) ->
+ clear_timer(State),
+ ok.
+
+%%-----------------------------------------------------------
+%%------------------------ attributes -----------------------
+%%-----------------------------------------------------------
+%%----------------------------------------------------------%
+%% Attribute: '_get_status'
+%% Type : readonly
+%% Returns : 'ESTimeSet' | 'ESTimeCleared' | 'ESTriggered' |
+%% 'ESFailedTrigger'
+%%-----------------------------------------------------------
+'_get_status'(_OE_THIS, State) ->
+ {reply, ?get_Status(State), State}.
+
+%%-----------------------------------------------------------
+%%------- Exported external functions -----------------------
+%%-----------------------------------------------------------
+%%----------------------------------------------------------%
+%% function : time_set
+%% Arguments: -
+%% Returns : {boolean(), CosTime::UTO}
+%%-----------------------------------------------------------
+time_set(_OE_THIS, State) when ?is_UtoSet(State) ->
+ {reply, {?is_TimeSet(State), ?get_Uto(State)}, State};
+time_set(_OE_THIS, State) ->
+ Utc = #'TimeBase_UtcT'{time=0, inacclo = 0,inacchi = 0, tdf = 0},
+ {reply,
+ {?is_TimeSet(State),
+ 'CosTime_UTO':oe_create([Utc, ?get_TimeObj(State)], [{pseudo,true}|?CREATE_OPTS])},
+ State}.
+
+
+%%-----------------------------------------------------------
+%% function : set_timer
+%% Arguments: TimeType - 'TTAbsolute' | 'TTRelative' | 'TTPeriodic'
+%% TriggerTime - CosTime::UTO
+%% Returns : ok
+%%-----------------------------------------------------------
+set_timer(_OE_THIS, State, 'TTAbsolute', TriggerTime) ->
+ NewState = clear_timer(State),
+ ?time_TypeCheck(TriggerTime, 'CosTime_UTO'),
+ case catch {'CosTime_UTO':'_get_time'(TriggerTime),
+ 'CosTime_UTO':'_get_time'(
+ 'CosTime_TimeService':universal_time(?get_TimeObj(State)))} of
+ {Time, CurrentTime} when is_integer(Time) andalso is_integer(CurrentTime) andalso
+ Time > CurrentTime ->
+ %% Set a timer to send a message in (Time-CurrentTime)*10^-7 secs.
+ case timer:send_after(?convert_TimeT2TimerT(Time-CurrentTime), oe_event) of
+ {ok, TRef} ->
+ NewState1 = ?set_Timer(NewState, TRef),
+ NewState2 = ?set_Uto(NewState1, TriggerTime, 'TTAbsolute'),
+ ?debug_print("TIMER SET: ~p~n", [?convert_TimeT2TimerT(Time-CurrentTime)]),
+ {reply, ok, ?set_Status(NewState2, 'ESTimeSet')};
+ _->
+ corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO})
+ end;
+ {Time, CurrentTime} when is_integer(Time) andalso is_integer(CurrentTime) ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO});
+ _->
+ corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO})
+ end;
+set_timer(_OE_THIS, State, 'TTRelative', TriggerTime) ->
+ NewState = clear_timer(State),
+ ?time_TypeCheck(TriggerTime, 'CosTime_UTO'),
+ case catch {'CosTime_UTO':'_get_time'(TriggerTime), ?get_Time(State)} of
+ {0,OldTime} when ?is_NotAbsolute(NewState) andalso is_integer(OldTime) ->
+ %% Set a timer to send a message within Time*10^-7 secs
+ case timer:send_after(OldTime, oe_event) of
+ {ok, TRef} ->
+ NewState1 = ?set_Timer(NewState, TRef),
+ NewState2 = ?set_Uto(NewState1, TriggerTime, 'TTRelative'),
+ ?debug_print("TIMER SET: ~p~n", [?convert_TimeT2TimerT(OldTime)]),
+ {reply, ok, ?set_Status(NewState2, 'ESTimeSet')};
+ _->
+ corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO})
+ end;
+ {UtoTime,_} when is_integer(UtoTime) ->
+ %% Set a timer to send a message within Time*10^-7 secs
+ Time = ?convert_TimeT2TimerT(UtoTime),
+ case timer:send_after(Time, oe_event) of
+ {ok, TRef} ->
+ NewState1 = ?set_Timer(NewState, TRef),
+ NewState2 = ?set_TimeData(NewState1, TriggerTime,
+ 'TTRelative', Time),
+ ?debug_print("TIMER SET: ~p~n", [?convert_TimeT2TimerT(Time)]),
+ {reply, ok, ?set_Status(NewState2, 'ESTimeSet')};
+ _->
+ corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO})
+ end;
+
+ _->
+ {reply, {'EXCEPTION', #'BAD_PARAM'{completion_status=?COMPLETED_NO}}, NewState}
+ end;
+set_timer(_OE_THIS, State, 'TTPeriodic', TriggerTime) ->
+ NewState = clear_timer(State),
+ ?time_TypeCheck(TriggerTime, 'CosTime_UTO'),
+ case catch {'CosTime_UTO':'_get_time'(TriggerTime), ?get_Time(State)} of
+ {0,OldTime} when ?is_NotAbsolute(NewState) andalso is_integer(OldTime) ->
+ %% Set a timer to send a message within Time*10^-7 secs
+ case timer:send_interval(OldTime, oe_periodic_event) of
+ {ok, TRef} ->
+ NewState1 = ?set_Timer(NewState, TRef),
+ NewState2 = ?set_Uto(NewState1, TriggerTime, 'TTPeriodic'),
+ ?debug_print("TIMER SET: ~p~n", [?convert_TimeT2TimerT(OldTime)]),
+ {reply, ok, ?set_Status(NewState2, 'ESTimeSet')};
+ _->
+ corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO})
+ end;
+ {UtoTime,_} when is_integer(UtoTime) ->
+ %% Set a timer to send a message within Time*10^-7 secs
+ Time = ?convert_TimeT2TimerT(UtoTime),
+ case timer:send_interval(Time, oe_periodic_event) of
+ {ok, TRef} ->
+ NewState1 = ?set_Timer(NewState, TRef),
+ NewState2 = ?set_TimeData(NewState1, TriggerTime,
+ 'TTPeriodic', Time),
+ ?debug_print("TIMER SET: ~p~n", [?convert_TimeT2TimerT(Time)]),
+ {reply, ok, ?set_Status(NewState2, 'ESTimeSet')};
+ _->
+ corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO})
+ end;
+
+ _->
+ {reply, {'EXCEPTION', #'BAD_PARAM'{completion_status=?COMPLETED_NO}}, NewState}
+ end;
+set_timer(_OE_THIS, _State, _, _) ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}).
+
+%%----------------------------------------------------------%
+%% function : cancel_timer
+%% Arguments: -
+%% Returns : boolean()
+%%-----------------------------------------------------------
+cancel_timer(_OE_THIS, State) ->
+ NewState=clear_timer(State),
+ case ?get_Status(NewState) of
+ 'ESTriggered' ->
+ {reply, false, NewState};
+ 'ESFailedTrigger' ->
+ {reply, false, NewState};
+ _ ->
+ {reply, true, ?set_Status(NewState, 'ESTimeCleared')}
+ end.
+
+%%----------------------------------------------------------%
+%% function : set_data
+%% Arguments: EventData - any#
+%% Returns : ok
+%%-----------------------------------------------------------
+set_data(_OE_THIS, State, EventData) when is_record(EventData, any) ->
+ {reply, ok, ?set_Event(State, EventData)};
+set_data(_OE_THIS, _State, _EventData) ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}).
+
+
+%%--------------- LOCAL FUNCTIONS ----------------------------
+clear_timer(State) when ?get_Timer(State) == undefined ->
+ State;
+clear_timer(State) ->
+ catch timer:cancel(?get_Timer(State)),
+ ?set_Timer(State, undefined).
+
+%%--------------- MISC FUNCTIONS, E.G. DEBUGGING -------------
+%%--------------- END OF MODULE ------------------------------
diff --git a/lib/cosTime/src/CosTimerEvent_TimerEventService_impl.erl b/lib/cosTime/src/CosTimerEvent_TimerEventService_impl.erl
new file mode 100644
index 0000000000..b324ecbecd
--- /dev/null
+++ b/lib/cosTime/src/CosTimerEvent_TimerEventService_impl.erl
@@ -0,0 +1,118 @@
+%%--------------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%----------------------------------------------------------------------
+%% File : CosTimerEvent_TimerEventService_impl.erl
+%% Purpose :
+%%----------------------------------------------------------------------
+
+-module('CosTimerEvent_TimerEventService_impl').
+
+%%--------------- INCLUDES -----------------------------------
+-include("cosTimeApp.hrl").
+
+
+%%--------------- EXPORTS ------------------------------------
+%%--------------- External -----------------------------------
+%% Interface functions
+-export([register/4, unregister/3, event_time/3]).
+
+%%--------------- gen_server specific exports ----------------
+-export([handle_info/2, code_change/3]).
+-export([init/1, terminate/2]).
+
+
+%% Data structures
+-record(state, {timer}).
+%% Data structures constructors
+-define(get_InitState(T),
+ #state{timer=T}).
+
+%% Data structures selectors
+-define(get_TimerObj(S), S#state.timer).
+
+%% Data structures modifiers
+
+%% MISC
+
+%%-----------------------------------------------------------%
+%% function : handle_info, code_change
+%% Arguments:
+%% Returns :
+%% Effect : Functions demanded by the gen_server module.
+%%------------------------------------------------------------
+
+code_change(_OldVsn, State, _Extra) ->
+ {ok, State}.
+
+handle_info(_Info, State) ->
+ ?debug_print("INFO: ~p~n", [_Info]),
+ {noreply, State}.
+
+%%----------------------------------------------------------%
+%% function : init, terminate
+%% Arguments:
+%%-----------------------------------------------------------
+
+init([Timer]) ->
+ process_flag(trap_exit, true),
+ timer:start(),
+ {ok, ?get_InitState(Timer)}.
+
+terminate(_Reason, _State) ->
+ ok.
+
+%%-----------------------------------------------------------
+%%------- Exported external functions -----------------------
+%%-----------------------------------------------------------
+%%----------------------------------------------------------%
+%% function : register
+%% Arguments: EventInterface - CosEventComm::PushConsumer
+%% Data - #any
+%% Returns : TimerEventHandler - objref#
+%%-----------------------------------------------------------
+register(OE_THIS, State, EventInterface, Data) ->
+ {reply,
+ cosTime:start_event_handler([OE_THIS, self(),EventInterface, Data,
+ ?get_TimerObj(State)]),
+ State}.
+
+%%----------------------------------------------------------%
+%% function : unregister
+%% Arguments: TimerEventHandler - objref#
+%% Returns : ok
+%%-----------------------------------------------------------
+unregister(_OE_THIS, State, TimerEventHandler) ->
+ catch corba:dispose(TimerEventHandler),
+ {reply, ok, State}.
+
+%%----------------------------------------------------------%
+%% function : event_time
+%% Arguments: TimerEvent - #'CosTimerEvent_TimerEventT'{utc, event_data}
+%% Returns : CosTime::UTO
+%%-----------------------------------------------------------
+event_time(_OE_THIS, State, #'CosTimerEvent_TimerEventT'{utc=Utc}) ->
+ {reply, 'CosTime_UTO':oe_create([Utc],[{pseudo,true}]), State}.
+
+
+%%--------------- LOCAL FUNCTIONS ----------------------------
+
+%%--------------- MISC FUNCTIONS, E.G. DEBUGGING -------------
+%%--------------- END OF MODULE ------------------------------
diff --git a/lib/cosTime/src/Makefile b/lib/cosTime/src/Makefile
new file mode 100644
index 0000000000..3b6f7bae2e
--- /dev/null
+++ b/lib/cosTime/src/Makefile
@@ -0,0 +1,205 @@
+#
+# %CopyrightBegin%
+#
+# Copyright Ericsson AB 2000-2009. All Rights Reserved.
+#
+# The contents of this file are subject to the Erlang Public License,
+# Version 1.1, (the "License"); you may not use this file except in
+# compliance with the License. You should have received a copy of the
+# Erlang Public License along with this software. If not, it can be
+# retrieved online at http://www.erlang.org/.
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+# the License for the specific language governing rights and limitations
+# under the License.
+#
+# %CopyrightEnd%
+#
+#
+include $(ERL_TOP)/make/target.mk
+
+ifeq ($(TYPE),debug)
+ERL_COMPILE_FLAGS += -Ddebug -W
+endif
+
+include $(ERL_TOP)/make/$(TARGET)/otp.mk
+
+# ----------------------------------------------------
+# Application version
+# ----------------------------------------------------
+include ../vsn.mk
+VSN=$(COSTIME_VSN)
+
+# ----------------------------------------------------
+# Release directory specification
+# ----------------------------------------------------
+RELSYSDIR = $(RELEASE_PATH)/lib/cosTime-$(VSN)
+
+EXTERNAL_INC_PATH = ../include
+
+# ----------------------------------------------------
+# Target Specs
+# ----------------------------------------------------
+
+MODULES = \
+ cosTime \
+ CosTime_TIO_impl \
+ CosTime_TimeService_impl \
+ CosTime_UTO_impl \
+ CosTimerEvent_TimerEventHandler_impl \
+ CosTimerEvent_TimerEventService_impl \
+
+ERL_FILES = $(MODULES:%=%.erl)
+HRL_FILES = \
+ cosTimeApp.hrl \
+
+GEN_TIMEBASE_ERL_FILES = \
+ oe_TimeBase.erl \
+ TimeBase_IntervalT.erl \
+ TimeBase_UtcT.erl
+
+GEN_COSTIME_ERL_FILES = \
+ oe_CosTime.erl \
+ CosTime_TIO.erl \
+ CosTime_TimeService.erl \
+ CosTime_TimeUnavailable.erl \
+ CosTime_UTO.erl \
+
+GEN_COSTIMEREVENT_ERL_FILES = \
+ oe_CosTimerEvent.erl \
+ CosTimerEvent_TimerEventHandler.erl \
+ CosTimerEvent_TimerEventService.erl \
+ CosTimerEvent_TimerEventT.erl \
+
+GEN_TIMEBASE_HRL_FILES = \
+ oe_TimeBase.hrl \
+ TimeBase.hrl \
+
+EXTERNAL_TIMEBASE_HRL_FILES = $(GEN_TIMEBASE_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%)
+
+GEN_COSTIME_HRL_FILES = \
+ oe_CosTime.hrl \
+ CosTime.hrl \
+ CosTime_TIO.hrl \
+ CosTime_TimeService.hrl \
+ CosTime_UTO.hrl
+
+EXTERNAL_COSTIME_HRL_FILES = $(GEN_COSTIME_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%)
+
+GEN_COSTIMEREVENT_HRL_FILES = \
+ oe_CosTimerEvent.hrl \
+ CosTimerEvent.hrl \
+ CosTimerEvent_TimerEventHandler.hrl \
+ CosTimerEvent_TimerEventService.hrl \
+
+EXTERNAL_COSTIMEREVENT_HRL_FILES = $(GEN_COSTIMEREVENT_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%)
+
+
+GEN_ERL_FILES = \
+ $(GEN_TIMEBASE_ERL_FILES) \
+ $(GEN_COSTIME_ERL_FILES) \
+ $(GEN_COSTIMEREVENT_ERL_FILES)
+
+GEN_HRL_FILES = \
+ $(EXTERNAL_TIMEBASE_HRL_FILES) \
+ $(EXTERNAL_COSTIME_HRL_FILES) \
+ $(EXTERNAL_COSTIMEREVENT_HRL_FILES) \
+
+GEN_FILES = \
+ $(GEN_HRL_FILES) \
+ $(GEN_ERL_FILES)
+
+TARGET_FILES = \
+ $(GEN_TIMEBASE_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \
+ $(GEN_COSTIME_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \
+ $(GEN_COSTIMEREVENT_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \
+ $(MODULES:%=$(EBIN)/%.$(EMULATOR))
+
+IDL_FILES = \
+ TimeBase.idl \
+ CosTime.idl \
+ CosTimerEvent.idl
+
+APPUP_FILE = cosTime.appup
+APPUP_SRC = $(APPUP_FILE).src
+APPUP_TARGET = $(EBIN)/$(APPUP_FILE)
+
+APP_FILE = cosTime.app
+APP_SRC = $(APP_FILE).src
+APP_TARGET = $(EBIN)/$(APP_FILE)
+
+# ----------------------------------------------------
+# FLAGS
+# ----------------------------------------------------
+ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosTime/ebin \
+ -pa $(ERL_TOP)/lib/ic/ebin\
+ -pa $(ERL_TOP)/lib/orber/ebin \
+ -I$(ERL_TOP)/lib/cosEvent/src
+
+# The -pa option is just used temporary until erlc can handle
+# includes from other directories than ../include .
+ERL_COMPILE_FLAGS += \
+ $(ERL_IDL_FLAGS) \
+ -pa $(ERL_TOP)/lib/orber/include \
+ -pa $(ERL_TOP)/lib/cosTime/include \
+ -I$(ERL_TOP)/lib/cosTime/include \
+ -I$(ERL_TOP)/lib/orber/include \
+ +'{parse_transform,sys_pre_attributes}' \
+ +'{attribute,insert,app_vsn,"cosTime_$(COSTIME_VSN)"}'
+
+
+# ----------------------------------------------------
+# Targets
+# ----------------------------------------------------
+opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET)
+
+debug:
+ @${MAKE} TYPE=debug opt
+
+cleanb:
+ rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET)
+ rm -f errs core *~
+
+clean:
+ rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET)
+ rm -f errs core *~
+
+$(APP_TARGET): $(APP_SRC)
+ sed -e 's;%VSN%;$(VSN);' $< > $@
+
+$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk
+ sed -e 's;%VSN%;$(VSN);' $< > $@
+
+docs:
+
+# ----------------------------------------------------
+# Special Build Targets
+# ----------------------------------------------------
+$(GEN_TIMEBASE_ERL_FILES) $(EXTERNAL_TIMEBASE_HRL_FILES): TimeBase.idl
+ erlc $(ERL_IDL_FLAGS) TimeBase.idl
+ mv $(GEN_TIMEBASE_HRL_FILES) $(EXTERNAL_INC_PATH)
+
+$(GEN_COSTIME_ERL_FILES) $(EXTERNAL_COSTIME_HRL_FILES): CosTime.idl
+ erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTime.cfg"}' CosTime.idl
+ mv $(GEN_COSTIME_HRL_FILES) $(EXTERNAL_INC_PATH)
+
+$(GEN_COSTIMEREVENT_ERL_FILES) $(EXTERNAL_COSTIMEREVENT_HRL_FILES): CosTimerEvent.idl
+ erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosTimerEvent.cfg"}' CosTimerEvent.idl
+ mv $(GEN_COSTIMEREVENT_HRL_FILES) $(EXTERNAL_INC_PATH)
+
+# ----------------------------------------------------
+# Release Target
+# ----------------------------------------------------
+include $(ERL_TOP)/make/otp_release_targets.mk
+
+release_spec: opt
+ $(INSTALL_DIR) $(RELSYSDIR)/ebin
+ $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) $(RELSYSDIR)/ebin
+ $(INSTALL_DIR) $(RELSYSDIR)/src
+ $(INSTALL_DATA) $(GEN_FILES) $(IDL_FILES) $(RELSYSDIR)/src
+ $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(GEN_ERL_FILES) $(IDL_FILES) $(RELSYSDIR)/src
+ $(INSTALL_DIR) $(RELSYSDIR)/include
+ $(INSTALL_DATA) $(GEN_HRL_FILES) $(RELSYSDIR)/include
+
+release_docs_spec:
diff --git a/lib/cosTime/src/TimeBase.idl b/lib/cosTime/src/TimeBase.idl
new file mode 100644
index 0000000000..92a0c652d8
--- /dev/null
+++ b/lib/cosTime/src/TimeBase.idl
@@ -0,0 +1,22 @@
+#ifndef _TIMEBASE_IDL_
+#define _TIMEBASE_IDL_
+
+#pragma prefix "omg.org"
+
+module TimeBase {
+ typedef unsigned long long TimeT;
+ typedef TimeT InaccuracyT;
+ typedef short TdfT;
+ struct UtcT {
+ TimeT time; // 8 octets
+ unsigned long inacclo; // 4 octets
+ unsigned short inacchi; // 2 octets
+ TdfT tdf; // 2 octets // total 16 octets.
+ };
+ struct IntervalT {
+ TimeT lower_bound;
+ TimeT upper_bound;
+ };
+};
+
+#endif
diff --git a/lib/cosTime/src/cosTime.app.src b/lib/cosTime/src/cosTime.app.src
new file mode 100644
index 0000000000..191ee5f3db
--- /dev/null
+++ b/lib/cosTime/src/cosTime.app.src
@@ -0,0 +1,30 @@
+{application, cosTime,
+ [{description, "The Erlang CosTime application"},
+ {vsn, "%VSN%"},
+ {modules,
+ [
+ 'cosTime',
+ 'oe_TimeBase',
+ 'oe_CosTime',
+ 'oe_CosTimerEvent',
+ 'CosTime_TIO',
+ 'CosTime_TimeService',
+ 'CosTime_TimeUnavailable',
+ 'CosTime_UTO',
+ 'CosTimerEvent_TimerEventHandler',
+ 'CosTimerEvent_TimerEventService',
+ 'CosTimerEvent_TimerEventT',
+ 'TimeBase_IntervalT',
+ 'TimeBase_UtcT',
+ 'CosTime_TIO_impl',
+ 'CosTime_TimeService_impl',
+ 'CosTime_UTO_impl',
+ 'CosTimerEvent_TimerEventHandler_impl',
+ 'CosTimerEvent_TimerEventService_impl'
+ ]
+ },
+ {registered, [oe_cosTimeSup, oe_cosTimerEventService]},
+ {applications, [orber, stdlib, kernel]},
+ {env, []},
+ {mod, {cosTime, []}}
+]}.
diff --git a/lib/cosTime/src/cosTime.appup.src b/lib/cosTime/src/cosTime.appup.src
new file mode 100644
index 0000000000..f3eead4a0c
--- /dev/null
+++ b/lib/cosTime/src/cosTime.appup.src
@@ -0,0 +1,6 @@
+{"%VSN%",
+ [
+ ],
+ [
+ ]
+}.
diff --git a/lib/cosTime/src/cosTime.erl b/lib/cosTime/src/cosTime.erl
new file mode 100644
index 0000000000..f4e67570ad
--- /dev/null
+++ b/lib/cosTime/src/cosTime.erl
@@ -0,0 +1,321 @@
+%%--------------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%----------------------------------------------------------------------
+%% File : cosTime.erl
+%% Purpose :
+%%----------------------------------------------------------------------
+
+-module(cosTime).
+
+%%--------------- INCLUDES -----------------------------------
+-include("cosTimeApp.hrl").
+
+%%--------------- EXPORTS-------------------------------------
+%% cosTime API external
+-export([start/0, stop/0,
+ install_time/0, uninstall_time/0,
+ install_timerevent/0, uninstall_timerevent/0,
+ start_time_service/2, start_timerevent_service/1, stop_timerevent_service/1,
+ stop_time_service/1]).
+
+%% cosTime API internal
+-export([create_link/3, get_option/3, type_check/2, start_event_handler/1]).
+
+%% Application callbacks
+-export([start/2, init/1, stop/1]).
+
+%%--------------- DEFINES ------------------------------------
+-define(IDL_TIME_MODULES, ['oe_TimeBase',
+ 'oe_CosTime']).
+-define(IDL_TIMEREVENT_MODULES, ['oe_CosTimerEvent']).
+-define(SUPERVISOR_NAME, oe_cosTimeSup).
+-define(SUP_FLAG, {simple_one_for_one,50,10}).
+-define(SUP_TIMESERVICE_SPEC(T,I),
+ ['CosTime_TimeService',[T, I],
+ [{sup_child, true}, {regname, {global, "oe_cosTimeService"}}]]).
+-define(SUP_TIMEREVENTSERVICE_SPEC(Args),
+ ['CosTimerEvent_TimerEventService', Args,
+ [{sup_child, true}, {regname, {local, 'oe_cosTimerEventService'}}]]).
+-define(SUP_TIMEREVENTHANDLER_SPEC(Name, Args),
+ ['CosTimerEvent_TimerEventHandler',Args,
+ [{sup_child, true}, {regname, {global, Name}}]]).
+-define(SUP_CHILD,
+ {"oe_TimeChild",
+ {cosTime,create_link, []},
+ transient,100000,worker,
+ []}).
+
+%%------------------------------------------------------------
+%% function : install_*/X
+%% Arguments: - | Time (seconds)
+%% Returns : ok | EXIT | EXCEPTION
+%% Effect : Install necessary data in the IFR DB
+%%------------------------------------------------------------
+
+install_time() ->
+ install_loop(?IDL_TIME_MODULES,[]).
+
+install_timerevent() ->
+ install_loop(?IDL_TIMEREVENT_MODULES,[]).
+
+install_loop([], _) ->
+ ok;
+install_loop([H|T], Accum) ->
+ case catch H:'oe_register'() of
+ {'EXIT',{unregistered,App}} ->
+ ?write_ErrorMsg("Unable to register '~p'; application ~p not registered.
+Trying to unregister ~p~n", [H,App,Accum]),
+ uninstall_loop(Accum, {exit, register});
+ {'EXCEPTION',_} ->
+ ?write_ErrorMsg("Unable to register '~p'; propably already registered.
+You are adviced to confirm this.
+Trying to unregister ~p~n", [H,Accum]),
+ uninstall_loop(Accum, {exit, register});
+ ok ->
+ install_loop(T, [H|Accum]);
+ _ ->
+ ?write_ErrorMsg("Unable to register '~p'; reason unknown.
+Trying to unregister ~p~n", [H,Accum]),
+ uninstall_loop(Accum, {exit, register})
+ end.
+
+%%------------------------------------------------------------
+%% function : uninstall_*/X
+%% Arguments: - | Time (seconds)
+%% Returns : ok | EXIT | EXCEPTION
+%% Effect : Remove data related to cosTime from the IFR DB
+%%------------------------------------------------------------
+
+uninstall_time() ->
+ uninstall_loop(lists:reverse(?IDL_TIME_MODULES),ok).
+
+uninstall_timerevent() ->
+ uninstall_loop(lists:reverse(?IDL_TIMEREVENT_MODULES),ok).
+
+uninstall_loop([],ok) ->
+ ok;
+uninstall_loop([],{exit, register}) ->
+ exit({?MODULE, "oe_register failed"});
+uninstall_loop([],{exit, unregister}) ->
+ exit({?MODULE, "oe_unregister failed"});
+uninstall_loop([],{exit, both}) ->
+ exit({?MODULE, "oe_register and, for some of those already registered, oe_unregister failed"});
+uninstall_loop([H|T], Status) ->
+ case catch H:'oe_unregister'() of
+ ok ->
+ uninstall_loop(T, Status);
+ _ when Status == ok ->
+ ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered.
+You are adviced to confirm this.~n",[H]),
+ uninstall_loop(T, {exit, unregister});
+ _ ->
+ ?write_ErrorMsg("Unable to unregister '~p'; propably already unregistered.
+You are adviced to confirm this.~n",[H]),
+ uninstall_loop(T, {exit, both})
+ end.
+
+%%------------------------------------------------------------
+%% function : start/stop
+%% Arguments:
+%% Returns :
+%% Effect : Starts or stops the cosTime application.
+%%------------------------------------------------------------
+
+start() ->
+ application:start(cosTime).
+stop() ->
+ application:stop(cosTime).
+
+%%------------------------------------------------------------
+%% function : start
+%% Arguments: Type - see module application
+%% Arg - see module application
+%% Returns :
+%% Effect : Module callback for application
+%%------------------------------------------------------------
+
+start(_, _) ->
+ supervisor:start_link({local, ?SUPERVISOR_NAME}, cosTime, app_init).
+
+
+%%------------------------------------------------------------
+%% function : stop
+%% Arguments: Arg - see module application
+%% Returns :
+%% Effect : Module callback for application
+%%------------------------------------------------------------
+
+stop(_) ->
+ ok.
+
+%%------------------------------------------------------------
+%% function : start_time_service
+%% Arguments: Tdf - time difference to UTC
+%% Inaccuracy - ulonglong
+%% Upper - inaccuracy high
+%% Returns :
+%% Effect :
+%%------------------------------------------------------------
+start_time_service(Tdf, Inaccuracy) when is_integer(Tdf) andalso is_integer(Inaccuracy) ->
+ case supervisor:start_child(?SUPERVISOR_NAME,
+ ?SUP_TIMESERVICE_SPEC(Tdf, Inaccuracy)) of
+ {ok, Pid, Obj} when is_pid(Pid) ->
+ Obj;
+ _Other->
+ corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO})
+ end;
+start_time_service(_Tdf, _Inaccuracy) ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}).
+
+
+%%------------------------------------------------------------
+%% function : stop_time_service
+%% Arguments: Obj - TimeService objref
+%% Returns :
+%% Effect :
+%%------------------------------------------------------------
+stop_time_service(Obj) ->
+ corba:dispose(Obj).
+
+%%------------------------------------------------------------
+%% function : start_timerevent_service
+%% Arguments: Timer - Timer Service Reference
+%% Returns :
+%% Effect :
+%%------------------------------------------------------------
+start_timerevent_service(Timer) ->
+ case supervisor:start_child(?SUPERVISOR_NAME,
+ ?SUP_TIMEREVENTSERVICE_SPEC([Timer])) of
+ {ok, Pid, Obj} when is_pid(Pid) ->
+ Obj;
+ _Other->
+ corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO})
+ end.
+
+%%-----------------------------------------------------------%
+%% function : stop_timerevent_service
+%% Arguments: Obj - TimerEventService objref
+%% Returns :
+%% Effect :
+%%------------------------------------------------------------
+stop_timerevent_service(Obj) ->
+ corba:dispose(Obj).
+
+%%-----------------------------------------------------------%
+%% function : init
+%% Arguments:
+%% Returns :
+%% Effect :
+%%------------------------------------------------------------
+
+%% Starting using create_factory/X
+init(own_init) ->
+ {ok,{?SUP_FLAG, [?SUP_CHILD]}};
+%% When starting as an application.
+init(app_init) ->
+ {ok,{?SUP_FLAG, [?SUP_CHILD]}}.
+
+%%-----------------------------------------------------------%
+%% function : create_link
+%% Arguments: Module - which Module to call
+%% Env/ArgList - ordinary oe_create arguments.
+%% Returns :
+%% Exception:
+%% Effect : Necessary since we want the supervisor to be a
+%% 'simple_one_for_one'. Otherwise, using for example,
+%% 'one_for_one', we have to call supervisor:delete_child
+%% to remove the childs startspecification from the
+%% supervisors internal state.
+%%------------------------------------------------------------
+create_link(Module, Env, ArgList) ->
+ Module:oe_create_link(Env, ArgList).
+
+%%-----------------------------------------------------------%
+%% function : start_event_handler
+%% Arguments:
+%% Returns :
+%% Exception:
+%% Effect :
+%%------------------------------------------------------------
+
+start_event_handler(Args) ->
+ Name = create_name(eventhandler),
+ case supervisor:start_child(?SUPERVISOR_NAME, ?SUP_TIMEREVENTHANDLER_SPEC(Name,Args)) of
+ {ok, Pid, Obj} when is_pid(Pid) ->
+ Obj;
+ _Other->
+ corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO})
+ end.
+
+
+%%-----------------------------------------------------------%
+%% function : get_option
+%% Arguments:
+%% Returns :
+%% Exception:
+%% Effect :
+%%------------------------------------------------------------
+
+get_option(Key, OptionList, DefaultList) ->
+ case lists:keysearch(Key, 1, OptionList) of
+ {value,{Key,Value}} ->
+ Value;
+ _ ->
+ case lists:keysearch(Key, 1, DefaultList) of
+ {value,{Key,Value}} ->
+ Value;
+ _->
+ {error, "Invalid option"}
+ end
+ end.
+
+%%-----------------------------------------------------------%
+%% function : type_check
+%% Arguments: Obj - objectrefernce to test.
+%% Mod - Module which contains typeID/0.
+%% Returns : 'ok' or raises exception.
+%% Effect :
+%%------------------------------------------------------------
+
+type_check(Obj, Mod) ->
+ case catch corba_object:is_a(Obj,Mod:typeID()) of
+ true ->
+ ok;
+ _ ->
+ corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO})
+ end.
+
+
+%%-----------------------------------------------------------%
+%% function : create_name/1
+%% Arguments:
+%% Returns :
+%% Exception:
+%% Effect :
+%%------------------------------------------------------------
+
+create_name(Type) ->
+ {MSec, Sec, USec} = erlang:now(),
+ lists:concat(['oe_',node(),'_',Type,'_',MSec, '_', Sec, '_', USec]).
+
+%%--------------- END OF MODULE ------------------------------
+
+
diff --git a/lib/cosTime/src/cosTimeApp.hrl b/lib/cosTime/src/cosTimeApp.hrl
new file mode 100644
index 0000000000..f3082816f7
--- /dev/null
+++ b/lib/cosTime/src/cosTimeApp.hrl
@@ -0,0 +1,76 @@
+%%----------------------------------------------------------------------
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2000-2009. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+%%
+%%----------------------------------------------------------------------
+%% File : cosTimeApp.hrl
+%% Purpose :
+%%----------------------------------------------------------------------
+
+
+%%--------------- INCLUDES -----------------------------------
+%% External
+-include_lib("orber/include/corba.hrl").
+-include_lib("orber/include/ifr_types.hrl").
+
+%% Local
+-include("CosTimerEvent.hrl").
+-include("CosTime.hrl").
+-include("CosTimerEvent.hrl").
+-include("TimeBase.hrl").
+
+-define(CREATE_OPTS, [{no_security, orber:partial_security()}]).
+
+-define(max_Inaccuracy, 281474976710655).
+-define(max_TimeT, 18446744073709551616).
+
+%% The calendar module uses year 0 as base for gregorian functions.
+%% 'ABSOULTE_TIME_DIFF' is #seconfs from year 0 until 15 october 1582, 00:00.
+-define(ABSOLUTE_TIME_DIFF, 49947926400).
+%% As above but diff year 0 to 00:00 GMT, January 1, 1970
+-define(STANDARD_TIME_DIFF, 62167219200).
+
+-define(split_TimeT(T), {((T band 16#0000ffff00000000) bsr 32),
+ (T band 16#00000000ffffffff)}).
+
+-define(high_TimeT(T), ((T band 16#0000ffff00000000) bsr 32)).
+-define(low_TimeT(T), (T band 16#00000000ffffffff)).
+
+-define(concat_TimeT(H,L), ((H bsl 32) + L)).
+
+-define(convert_TimeT2TimerT(N), erlang:trunc(N*1.0e-4)).
+
+-define(write_ErrorMsg(Txt, Arg),
+error_logger:error_msg("================ CosTime ==================~n"
+ Txt
+ "===========================================~n",
+ Arg)).
+
+
+
+-ifdef(debug).
+-define(debug_print(F,A),
+ io:format("[LINE: ~p MODULE: ~p] "++F,[?LINE, ?MODULE]++A)).
+-define(time_TypeCheck(O,M), 'cosTime':type_check(O,M)).
+-else.
+-define(debug_print(F,A), ok).
+-define(time_TypeCheck(O,I), ok).
+-endif.
+
+%%--------------- END OF MODULE ------------------------------
diff --git a/lib/cosTime/vsn.mk b/lib/cosTime/vsn.mk
new file mode 100644
index 0000000000..ac5e99a0f1
--- /dev/null
+++ b/lib/cosTime/vsn.mk
@@ -0,0 +1,9 @@
+COSTIME_VSN = 1.1.7
+
+TICKETS = OTP-8201
+
+TICKETS_1.1.6 = OTP-7987
+
+TICKETS_1.1.5 = OTP-7837
+
+TICKETS_1.1.4 = OTP-7595