Index: palm/trunk/SOURCE/local_tremain.f90
===================================================================
--- palm/trunk/SOURCE/local_tremain.f90	(revision 4901)
+++ palm/trunk/SOURCE/local_tremain.f90	(revision 1)
@@ -1,34 +1,48 @@
-!> @file local_tremain.f90
-!--------------------------------------------------------------------------------------------------!
-! This file is part of the PALM model system.
-!
-! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General
-! Public License as published by the Free Software Foundation, either version 3 of the License, or
-! (at your option) any later version.
-!
-! PALM 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 General
-! Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with PALM. If not, see
-! <http://www.gnu.org/licenses/>.
-!
-! Copyright 1997-2021 Leibniz Universitaet Hannover
-!--------------------------------------------------------------------------------------------------!
-!
-! Current revisions:
+ SUBROUTINE local_tremain( remaining_time )
+
+!------------------------------------------------------------------------------!
+! Actual revisions:
 ! -----------------
-!
+! 
 !
 ! Former revisions:
 ! -----------------
-! $Id$
-! file re-formatted to follow the PALM coding standard
+! $Log: local_tremain.f90,v $
+! Revision 1.14  2006/06/02 15:20:33  raasch
+! Extended to TIT Sun Fire X4600 System (lctit)
 !
-! 4360 2020-01-07 11:25:50Z suehring
-! Corrected "Former revisions" section
+! Revision 1.13  2003/05/09 14:39:55  raasch
+! Time measurement on IBM is now done using function irtc, which allows correct
+! measurements for jobs running over the 24:00 timeline
 !
-! 3655 2019-01-07 16:51:22Z knoop
-! Corrected "Former revisions" section
+! Revision 1.12  2003/03/16 09:41:49  raasch
+! Two underscores (_) are placed in front of all define-strings
+!
+! Revision 1.11  2003/03/14 13:44:20  raasch
+! Print statement for testing removed
+!
+! Revision 1.10  2003/03/12 16:33:55  raasch
+! Extended to NEC-SX6 systems
+!
+! Revision 1.9  2002/12/19 15:49:17  raasch
+! Extended to IBM-Regatta systems
+!
+! Revision 1.8  2001/03/30 07:35:00  raasch
+! Translation of remaining German identifiers (variables, subroutines, etc.)
+!
+! Revision 1.7  2001/01/22 08:34:53  raasch
+! Module test_variables removed
+!
+! Revision 1.5  1998/07/16 06:51:44  raasch
+! cpp-Direktiven fuer t3ej2 und t3ej5 erweitert
+!
+! Revision 1.4  1998/07/06 12:19:02  raasch
+! + USE test_variables
+!
+! Revision 1.3  1998/03/24 15:27:23  raasch
+! Zeitbestimmung auf t3eh aufgenommen
+!
+! Revision 1.2  1998/03/23 08:39:53  raasch
+! Bestimmung der verbleibenden Zeit auf vpp ergaenzt
 !
 ! Revision 1.1  1998/03/18 20:14:47  raasch
@@ -38,30 +52,61 @@
 ! Description:
 ! ------------
-!> For different operating systems get the remaining cpu-time of the job
-!--------------------------------------------------------------------------------------------------!
- SUBROUTINE local_tremain( remaining_time )
+! For different operating systems get the remaining cpu-time of the job
+!------------------------------------------------------------------------------!
 
-
-    USE control_parameters,                                                                        &
-        ONLY:  maximum_cpu_time_allowed
-
-    USE cpulog,                                                                                    &
-        ONLY:  initial_wallclock_time
-
-    USE kinds
-
+    USE control_parameters
+    USE cpulog
     USE pegrid
 
     IMPLICIT NONE
 
-    INTEGER(idp) ::  count                 !<
-    INTEGER(idp) ::  count_rate            !<
+    REAL ::  remaining_time
+!#if defined( __vpp )
+!    REAL ::  cpu_time_used, rdum
+!#endif
+#if defined( __ibm )
+    INTEGER(8) ::  IRTC
+    REAL       ::  actual_wallclock_time
+#elif defined( __lctit )
+    INTEGER    ::  count, count_rate
+    REAL       ::  actual_wallclock_time
+#endif
 
-    REAL(wp)     ::  current_wallclock_time !<
-    REAL(wp)     ::  remaining_time        !<
+#if defined( __t3eh ) || defined( __t3eb ) || defined( __t3ej2 ) || defined( __t3ej5 )
+
+    CALL MPP_TREMAIN( remaining_time )
+
+!#elif defined( __vpp )
+!
+!    CALL CLOCKV( rdum, cpu_time_used, 0, 2 )
+!    remaining_time = maximum_cpu_time_allowed - cpu_time_used
+
+#elif defined( __ibm )
+
+!    CALL SYSTEM_CLOCK( count, count_rate )
+!    actual_wallclock_time = REAL( count ) / REAL( count_rate )
+    actual_wallclock_time = IRTC( ) * 1E-9
+    remaining_time = maximum_cpu_time_allowed - &
+                     ( actual_wallclock_time - initial_wallclock_time )
+
+#elif defined( __lctit )
 
     CALL SYSTEM_CLOCK( count, count_rate )
-    current_wallclock_time = REAL( count, KIND=wp ) / REAL( count_rate, KIND=wp )
-    remaining_time = maximum_cpu_time_allowed - ( current_wallclock_time - initial_wallclock_time )
+    actual_wallclock_time = REAL( count ) / REAL( count_rate )
+    remaining_time = maximum_cpu_time_allowed - &
+                     ( actual_wallclock_time - initial_wallclock_time )
+
+#elif defined( __nec )
+    
+    CALL TREMAIN( remaining_time )
+    remaining_time = remaining_time / tasks_per_node
+
+#else
+
+!
+!-- No stop due to running out of cpu-time on other machines
+    remaining_time = 9999999.9
+
+#endif
 
  END SUBROUTINE local_tremain
