From patchwork Wed Jun 23 06:17:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 56588 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 93C4FB6F06 for ; Wed, 23 Jun 2010 16:17:39 +1000 (EST) Received: (qmail 23502 invoked by alias); 23 Jun 2010 06:17:38 -0000 Received: (qmail 23493 invoked by uid 22791); 23 Jun 2010 06:17:37 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 23 Jun 2010 06:17:33 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 59B5CCB027F; Wed, 23 Jun 2010 08:17:36 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 84uCA0Z3fmYK; Wed, 23 Jun 2010 08:17:36 +0200 (CEST) Received: from saumur.act-europe.fr (saumur.act-europe.fr [10.10.0.183]) by mel.act-europe.fr (Postfix) with ESMTP id 451AACB024A; Wed, 23 Jun 2010 08:17:36 +0200 (CEST) Received: by saumur.act-europe.fr (Postfix, from userid 525) id 1352CD9AB0; Wed, 23 Jun 2010 08:17:35 +0200 (CEST) Date: Wed, 23 Jun 2010 08:17:35 +0200 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vincent Celier Subject: [Ada] Ada.Real_Time not properly initialized on Windows Message-ID: <20100623061735.GA29938@adacore.com> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * a-reatim.adb: Call System.OS_Primitives.Initialize during elaboration 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;