[Ada] Ada.Real_Time not properly initialized on Windows

Submitted by Arnaud Charlet on June 23, 2010, 6:17 a.m.

Details

Message ID 20100623061735.GA29938@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet June 23, 2010, 6:17 a.m.
On Windows, when using only Ada.Real_Time and not Ada.Calendar and not
using any real time feature such as a delay, some necessary
initialization was not performed and the values returned by function
Clock were constant and incorrect. This patch fixes that.
The test for this is to check that two values of Time obtained by calling
function Clock with some sufficient long processing are different.

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-06-23  Vincent Celier  <celier@adacore.com>

	* a-reatim.adb: Call System.OS_Primitives.Initialize during elaboration

Patch hide | download patch | download mbox

Index: a-reatim.adb
===================================================================
--- a-reatim.adb	(revision 161073)
+++ a-reatim.adb	(working copy)
@@ -7,7 +7,7 @@ 
 --                                 B o d y                                  --
 --                                                                          --
 --             Copyright (C) 1991-1994, Florida State University            --
---                     Copyright (C) 1995-2009, AdaCore                     --
+--                     Copyright (C) 1995-2010, AdaCore                     --
 --                                                                          --
 -- GNARL is free software; you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -32,6 +32,8 @@ 
 --                                                                          --
 ------------------------------------------------------------------------------
 
+with System.OS_Primitives;
+
 package body Ada.Real_Time is
 
    ---------
@@ -242,4 +244,6 @@  package body Ada.Real_Time is
       return Time_Span (D);
    end To_Time_Span;
 
+begin
+   System.OS_Primitives.Initialize;
 end Ada.Real_Time;