private function GreaterThan(time1, time2) result(greater)
return true
if time1 is greater than time2
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
type(DateTime),
|
intent(in) |
|
|
:: |
time1 |
|
type(DateTime),
|
intent(in) |
|
|
:: |
time2 |
|
Return Value
logical
Variables
Type |
Visibility | Attributes |
|
Name |
| Initial | |
type(DateTime),
|
public |
|
:: |
tempTime1 |
|
|
|
type(DateTime),
|
public |
|
:: |
tempTime2 |
|
|
|
Source Code
FUNCTION GreaterThan &
!
(time1, time2) &
!
RESULT (greater)
IMPLICIT NONE
! Arguments with intent(in):
TYPE (DateTime), INTENT(IN) :: time1, time2
! Local declarations:
LOGICAL :: greater
TYPE (DateTime) :: tempTime1, tempTime2
!------------end of declaration------------------------------------------------
!converto to utc
tempTime1 = ToUtc (time1)
tempTime2 = ToUtc (time2)
!perform comparison
IF(tempTime1 % year > tempTime2 % year) THEN
greater = .TRUE.
ELSE IF(tempTime1 % year < tempTime2 % year) THEN
greater = .FALSE.
ELSE IF(tempTime1 % month > tempTime2 % month) THEN
greater = .TRUE.
ELSE IF(tempTime1 % month < tempTime2 % month) THEN
greater = .FALSE.
ELSE IF(tempTime1 % day > tempTime2 % day) THEN
greater = .TRUE.
ELSE IF(tempTime1 % day < tempTime2 % day) THEN
greater = .FALSE.
ELSE IF(tempTime1 % hour > tempTime2 % hour) THEN
greater = .TRUE.
ELSE IF(tempTime1 % hour < tempTime2 % hour) THEN
greater = .FALSE.
ELSE IF(tempTime1 % minute > tempTime2 % minute) THEN
greater = .TRUE.
ELSE IF(tempTime1 % minute < tempTime2 % minute) THEN
greater = .FALSE.
ELSE IF(tempTime1 % second > tempTime2 % second) THEN
greater = .TRUE.
ELSE
greater = .FALSE.
END IF
END FUNCTION GreaterThan