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

Last change on this file since 251 was 4, checked in by raasch, 18 years ago

Id keyword set as property for all *.f90 files

  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1 FUNCTION time_to_string( time )
2
3!------------------------------------------------------------------------------!
4! Actual revisions:
5! -----------------
6!
7!
8! Former revisions:
9! -----------------
10! $Id: time_to_string.f90 4 2007-02-13 11:33:16Z raasch $
11! RCS Log replace by Id keyword, revision history cleaned up
12!
13! Revision 1.3  2001/01/22 08:16:04  raasch
14! Comments translated into English
15!
16! Revision 1.1  1997/08/11 06:26:08  raasch
17! Initial revision
18!
19!
20! Description:
21! ------------
22! Transforming the time from real to character-string hh:mm:ss
23!------------------------------------------------------------------------------!
24
25    IMPLICIT NONE
26
27    CHARACTER (LEN=9) ::  time_to_string
28    INTEGER           ::  hours, minutes, seconds
29    REAL              ::  rest_time, time
30
31!
32!-- Calculate the number of hours, minutes, and seconds
33    hours     = INT( time / 3600.0 )
34    rest_time = time - hours * 3600
35    minutes   = INT( rest_time / 60.0 )
36    seconds   = rest_time - minutes * 60
37
38!
39!-- Build the string
40    IF ( hours < 100 )  THEN
41       WRITE (time_to_string,'(I2.2,'':'',I2.2,'':'',I2.2)')  hours, minutes, &
42                                                              seconds
43    ELSE
44       WRITE (time_to_string,'(I3.3,'':'',I2.2,'':'',I2.2)')  hours, minutes, &
45                                                              seconds
46    ENDIF
47
48 END FUNCTION time_to_string
Note: See TracBrowser for help on using the repository browser.