Salome HOME
add method NameChanged to update title name
[modules/kernel.git] / src / Utils / Utils_Timer.cxx
index 65325f103047bed0d812cc620f71932dce610d5a..517164443f2c8f2809ea423e2a1ffbf600680691 100644 (file)
@@ -1,36 +1,36 @@
-//  SALOME Utils : general SALOME's definitions and tools
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+//  SALOME Utils : general SALOME's definitions and tools
 //  File   : Utils_Timer.cxx
 //  Module : SALOME
-
+//
 # include "Utils_Timer.hxx"
 
 # include <iostream>
 
 #include "utilities.h"
 
-#ifndef WNT
+#ifndef WIN32
 static struct timezone *tz=(struct timezone*) malloc(sizeof(struct timezone));
 #else
 //timezone *tz=_timezone;
@@ -41,7 +41,7 @@ static struct timezone *tz=(struct timezone*) malloc(sizeof(struct timezone));
 #endif
 
 Utils_Timer::Utils_Timer() {
-#ifndef WNT
+#ifndef WIN32
   RefToInitialTMS = new tms;
   RefToCurrentTMS = new tms;
 
@@ -70,21 +70,21 @@ Utils_Timer::~Utils_Timer() {
 void Utils_Timer::Start() {
   if (Stopped) {
     Stopped = 0;
-#ifndef WNT
+#ifndef WIN32
     times(RefToInitialTMS);
     gettimeofday(RefToInitialTimeB,tz);
 #else
     SYSTEMTIME st;
     GetSystemTime(&st);
     SystemTimeToFileTime(&st, RefToInitialTMS);
-         time(RefToCurrentTimeB);
+          time(RefToCurrentTimeB);
 #endif
   }
 }
 
 void Utils_Timer::Stop() {
   if (!Stopped) {
-#ifndef WNT
+#ifndef WIN32
     times(RefToCurrentTMS);
     int diffr_user = RefToCurrentTMS->tms_utime - RefToInitialTMS->tms_utime;
     int diffr_sys  = RefToCurrentTMS->tms_stime - RefToInitialTMS->tms_stime;
@@ -97,8 +97,8 @@ void Utils_Timer::Stop() {
     GetSystemTime(&st);
     SystemTimeToFileTime(&st, RefToCurrentTMS);
     Cumul_user += (int)(((ULARGE_INTEGER*)(RefToCurrentTMS))->QuadPart - ((ULARGE_INTEGER*)(RefToInitialTMS))->QuadPart) / 10000000;
-         Cumul_sys = Cumul_user;
-         time(RefToCurrentTimeB);
+          Cumul_sys = Cumul_user;
+          time(RefToCurrentTimeB);
 #endif
    Stopped = 1;
   }
@@ -118,10 +118,12 @@ void Utils_Timer::Reset() {
 }
 
 void Utils_Timer::ShowAbsolute(){
-#ifndef WNT
+#if defined(_DEBUG_) || defined(_DEBUG)
+#ifndef WIN32
     unsigned long Absolute_user = (unsigned long) ((timeval*)RefToCurrentTimeB)->tv_sec ;
 #else
-    unsigned long Absolute_user = *RefToCurrentTimeB;
+    unsigned long Absolute_user = (unsigned long) *RefToCurrentTimeB;
 #endif
     MESSAGE("Absolute time: "   << Absolute_user  << " seconds ");
+#endif
 }