source: palm/trunk/SOURCE/time_to_string.f90 @ 4657

Last change on this file since 4657 was 4540, checked in by raasch, 5 years ago

files re-formatted to follow the PALM coding standard

  • Property svn:keywords set to Id
File size: 2.3 KB
RevLine 
[1682]1!> @file time_to_string.f90
[4540]2!--------------------------------------------------------------------------------------------------!
[2696]3! This file is part of the PALM model system.
[1036]4!
[4540]5! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General
6! Public License as published by the Free Software Foundation, either version 3 of the License, or
7! (at your option) any later version.
[1036]8!
[4540]9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11! Public License for more details.
[1036]12!
[4540]13! You should have received a copy of the GNU General Public License along with PALM. If not, see
14! <http://www.gnu.org/licenses/>.
[1036]15!
[4360]16! Copyright 1997-2020 Leibniz Universitaet Hannover
[4540]17!--------------------------------------------------------------------------------------------------!
[1036]18!
[4540]19!
[484]20! Current revisions:
[1]21! -----------------
[1321]22!
[2001]23!
[1321]24! Former revisions:
25! -----------------
26! $Id: time_to_string.f90 4540 2020-05-18 15:23:29Z pavelkrc $
[4540]27! File re-formatted to follow the PALM coding standard
28!
29!
30! 4360 2020-01-07 11:25:50Z suehring
[2716]31! Corrected "Former revisions" section
[4540]32!
[4182]33! 3655 2019-01-07 16:51:22Z knoop
34! Corrected "Former revisions" section
[1321]35!
[4182]36! Revision 1.1  1997/08/11 06:26:08  raasch
37! Initial revision
38!
39!
[1]40! Description:
41! ------------
[1682]42!> Transforming the time from real to character-string hh:mm:ss
[4540]43!--------------------------------------------------------------------------------------------------!
[1682]44 FUNCTION time_to_string( time )
[1]45
[4540]46
[1320]47    USE kinds
48
[1]49    IMPLICIT NONE
50
[4540]51    CHARACTER(LEN=9) ::  time_to_string  !<
[1]52
[4540]53    INTEGER(iwp)     ::  hours    !<
54    INTEGER(iwp)     ::  minutes  !<
55    INTEGER(iwp)     ::  seconds  !<
[1320]56
[4540]57    REAL(wp)         ::  rest_time  !<
58    REAL(wp)         ::  time       !<
[1320]59
[1]60!
61!-- Calculate the number of hours, minutes, and seconds
[1342]62    hours     = INT( time / 3600.0_wp )
63    rest_time = time - hours * 3600_wp
64    minutes   = INT( rest_time / 60.0_wp )
[1]65    seconds   = rest_time - minutes * 60
66
67!
68!-- Build the string
69    IF ( hours < 100 )  THEN
[4540]70       WRITE (time_to_string,'(I2.2,'':'',I2.2,'':'',I2.2)')  hours, minutes, seconds
[1]71    ELSE
[4540]72       WRITE (time_to_string,'(I3.3,'':'',I2.2,'':'',I2.2)')  hours, minutes, seconds
[1]73    ENDIF
74
75 END FUNCTION time_to_string
Note: See TracBrowser for help on using the repository browser.