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

Last change on this file since 1 was 1, checked in by raasch, 14 years ago

Initial repository layout and content

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