This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/23583] New: invalid implemenation of Ada Monotonic_Clock


The Ada Reference Manual states in D.8 Monotonic Time:

"(32)
A clock jump is the difference between two successive distinct values of the
clock (as observed by calling the Clock function). There shall be no backward
clock jumps."

The "clock" referenced above is the "Clock" function in "Ada.Real_Time".

The implementation of "Ada.Real_Time" in file "a-reatim.adb" acquires its "Time"
from "System.Task_Primitives.Operations.Monotonic_Clock".  Furthermore,
"System.Task_Primitives.Operations.Monotonic_Clock" in file "s-taprop.ads" states:

"   function Monotonic_Clock return Duration;
   pragma Inline (Monotonic_Clock);
   --  Returns "absolute" time, representeSystem.OS_Interfaced as an offset
relative to "the
   --  Epoch", which is Jan 1, 1970. This clock implementation is immune to
   --  the system's clock changes."

However, the implementation of Monotonic_Clock function above in file
"s-taprop.adb" acquires its time from "gettimeofday" defined in
"System.OS_Interface".  "gettimeofday" returns the "system's clock" time of day.
 Therefore, it is NOT "immune to the system's clock changes."

PROBLEM: "gettimeofday" is affected by system's clock changes.  This includes
backward clock jumps.

This problem also exists in "System.OS_Primitives" in file "s-osprim.adb" where
function "Monotomic_Clock" has another implementation which is only a renames of
function "Clock" in the same file.  This "Clock" also uses the "gettimeofday"
for the system clock.

POSSIBLE SOLUTION: Make Monotonic_Clock implemenations use the hardware clock
instead of the software system clock.

I am using "gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux
Thread model: posix
gcc version 4.0.0 20050519 (Red Hat 4.0.0-8)" on Fedora Core 4 Linux -
identified as "Linux version 2.6.11-1.1369_FC4
(bhcompile@decompose.build.redhat.com) (gcc version 4.0.0 20050525 (Red Hat
4.0.0-9)) #1 Thu Jun 2 22:55:56 EDT 2005"


Please let me know if you need any further information.

Thanks in advance for your help with this issue,
Stan

-- 
           Summary: invalid implemenation of Ada Monotonic_Clock
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Stanley dot Harmon at Sperry dot NGC dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: 4.0.0
  GCC host triplet: 4.0.0
GCC target triplet: 4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23583


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]