Discussion:
TimeService related bug fixes
Schmidt Thomas
2009-01-08 21:37:22 UTC
Permalink
Hi,

1. According to CORBAs "Time Service Specification, V1.1, May 2002" a
TimeT value is fractioned in 100 nanoseconds. But Micos TimeService
related implementations return a value fractioned in microseconds.

2. As I've reported earlier 'TimeService_impl::universal_time()'
returns an uninitialized variable to calculate its return value.

Both bugs are fixed as follows:

Index: TimeService_help.cc
===================================================================
RCS file: /usr/src/cvs/Communication/CORBA/mico/coss/time/
TimeService_help.cc,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 TimeService_help.cc
--- TimeService_help.cc 20 Feb 2008 15:22:26 -0000 1.1.1.1
+++ TimeService_help.cc 8 Jan 2009 21:17:40 -0000
@@ -50,7 +50,7 @@
tmp *= DAYLENGTH;
timeV += tmp;
//in 100 nano second steps
- timeV *= 1000000;
+ timeV *= NANO100;

return timeV;
}
@@ -58,7 +58,7 @@
//resolution is in miliseconds
TimeBase::TimeT getInaccuracy()
{
- TimeBase::TimeT retval =1000000*INACCURACY;
+ TimeBase::TimeT retval = NANO100 * INACCURACY;
return retval;
}

@@ -90,7 +90,7 @@
time_t etime;

//in 100 nano second steps
- timeV /= 1000000;
+ timeV /= NANO100;
//Offset from Unix Epoch to 15 October 1582
TimeBase::TimeT tmp = EPOCH2GREGOR;
tmp *= DAYLENGTH;
Index: TimeService_help.h
===================================================================
RCS file: /usr/src/cvs/Communication/CORBA/mico/coss/time/
TimeService_help.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 TimeService_help.h
--- TimeService_help.h 20 Feb 2008 15:22:26 -0000 1.1.1.1
+++ TimeService_help.h 8 Jan 2009 21:17:40 -0000
@@ -12,6 +12,9 @@
//inaccuracy of the internal clock in seconds
#define INACCURACY 1

+//Time units according to CORBAs "Time Service Specification, V1.1,
May 2002"
+#define NANO100 10000000
+
//use the secure time? Only if your system clock is very accurate!
//#define USESECURE

Index: TimeService_impl.cc
===================================================================
RCS file: /usr/src/cvs/Communication/CORBA/mico/coss/time/
TimeService_impl.cc,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 TimeService_impl.cc
--- TimeService_impl.cc 20 Feb 2008 15:22:26 -0000 1.1.1.1
+++ TimeService_impl.cc 8 Jan 2009 21:17:40 -0000
@@ -29,9 +29,8 @@
CosTime::UTO_ptr
TimeService_impl::universal_time()
{
-
- TimeBase::TimeT timeV = timeV + TimeBase::TimeT(getTime());
- TimeBase::TimeT inaccuracyV = 10000000;
+ TimeBase::TimeT timeV = TimeBase::TimeT(getTime());
+ TimeBase::TimeT inaccuracyV = NANO100;
inaccuracyV *= INACCURACY;
TimeBase::TdfT tdfV = getTimezone();

@@ -60,7 +59,8 @@
#else

mico_throw(CosTime::TimeUnavailable());
-
+ retval = (CosTime::UTO_ptr) NULL; // Avoid compiler warnings
+
#endif

return retval;
Index: TimeService_uto.cc
===================================================================
RCS file: /usr/src/cvs/Communication/CORBA/mico/coss/time/
TimeService_uto.cc,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 TimeService_uto.cc
--- TimeService_uto.cc 20 Feb 2008 15:22:27 -0000 1.1.1.1
+++ TimeService_uto.cc 8 Jan 2009 21:17:40 -0000
@@ -73,7 +73,7 @@

TimeBase::TimeT atimeV = timeV + TimeBase::TimeT(getTime());
TimeBase::TdfT atdfV = getTimezone();
- TimeBase::TimeT ainaccurV = 10000000;
+ TimeBase::TimeT ainaccurV = NANO100;
ainaccurV *= INACCURACY;

UTO_impl * utoAbs = new UTO_impl(atimeV, ainaccurV , atdfV);


My development environment: Apple Macintosh, PPC, MacOSX 10.4.11, GNU
gcc 4.0.1, MICO 2.3.13


Ciao

Thomas

--
Thomas Schmidt
Schneiderstr. 16
D-29575 Altenmedingen
Phone: +49-5807-209976
Cellular: +49-172-3011505
Skype: ThCSchmidt
Email: ***@vodafone.de
PGP: Key-ID: 0x810B6206
Karel Gardas
2009-01-12 08:18:37 UTC
Permalink
Hi Thomas,

I've tried to apply your patches over the weekend, but unfortunately
found that either your or mine MUA corrupted them and so ended applying
them manually, which give me a chance to somehow simplify some of them.

Anyway, please install darcs from here
http://wiki.darcs.net/index.html/Binaries (it's also available for your
MacOSX/PPC), version 1.x is enough and then get MICO head sources by:

darcs get --set-scripts-executable http://mico.org/mico-darcs-repository
mico

and verify that everything is there well.

Thanks!
Karel
PS: next time if possible, please either attach the patches (not
incorporate them into the email text) or just use darcs and send me
darcs patch.
--
Karel Gardas ***@objectsecurity.com
ObjectSecurity Ltd. http://www.objectsecurity.com
Loading...