gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
dcdatetimegt.f90
Go to the documentation of this file.
1! -*- mode: f90; coding: utf-8 -*-
2!-----------------------------------------------------------------------
3! Copyright (c) 2000-2026 Gtool Development Group. All rights reserved.
4!-----------------------------------------------------------------------
5!>
6!> @author Yasuhiro MORIKAWA
7!> @copyright Copyright (C) GFD Dennou Club, 2000-2026. All rights reserved. <br/>
8!> License is BSD-2-Clause. see [COPYRIGHT](@ref COPYRIGHT) in detail
9!> @en
10!> @brief Functions for user defined operation (>)
11!> @details
12!> This file contains implementation procedures of greater-than
13!> comparison for dc_date_types#DC_DATETIME and dc_date_types#DC_DIFFTIME.
14!> @enden
15!>
16!> @ja
17!> @brief 利用者定義演算子 (>) のための関数
18!> @details
19!> このファイルには dc_date_types#DC_DATETIME および dc_date_types#DC_DIFFTIME
20!> の大なり比較の実装手続きが含まれています。
21!> @endja
22!>
23
24!> @en
25!> @brief Compare two DC_DATETIME variables (>)
26!> @details
27!> Compare two datetime values.
28!> Returns .true. if the datetime stored in the first argument is
29!> later than the datetime stored in the second argument.
30!>
31!> @param[in] time1 First datetime to compare
32!> @param[in] time2 Second datetime to compare
33!> @return .true. if time1 > time2, .false. otherwise
34!> @enden
35!>
36!> @ja
37!> @brief 2つの DC_DATETIME 変数の比較 (>)
38!> @details
39!> 2 つの引数の日時を比較します.
40!> 1 つ目の引数に格納される日時が 2 つ目の引数に格納される日時
41!> よりも進んでいる場合, .true. が返ります.
42!>
43!> @param[in] time1 比較する1番目の日時
44!> @param[in] time2 比較する2番目の日時
45!> @return time1 > time2 の場合 .true., それ以外は .false.
46!> @endja
47logical function dcdatetime_gt_tt(time1, time2) result(result)
48
51 use dc_scaledsec, only: dc_scaled_sec, &
52 & operator(==), operator(<), operator(>), operator(<=), operator(>=), &
53 & operator(+), operator(-), operator(*), operator(/), &
54 & modulo, int, abs, sign
55 implicit none
56 type(dc_datetime), intent(in):: time1, time2
57 type(dc_scaled_sec):: year1, year2, time1_sec, time2_sec
58continue
59 call eval(time1, sclyear=year1)
60 call eval(time2, sclyear=year2)
61 if (year1 > year2) then
62 result = .true.
63 elseif (year1 < year2) then
64 result = .false.
65 else
66 time1_sec = evalsclsec(time1) + evalsclsec(zonetodiff(time1 % zone))
67 time2_sec = evalsclsec(time2) + evalsclsec(zonetodiff(time2 % zone))
68 if (time1_sec > time2_sec) then
69 result = .true.
70 else
71 result = .false.
72 end if
73 end if
74end function dcdatetime_gt_tt
75
76!> @en
77!> @brief Compare two DC_DIFFTIME variables (>)
78!> @details
79!> Compare two time difference values.
80!> Returns .true. if the time difference stored in the first argument is
81!> greater than the time difference stored in the second argument.
82!>
83!> @param[in] diff1 First time difference to compare
84!> @param[in] diff2 Second time difference to compare
85!> @return .true. if diff1 > diff2, .false. otherwise
86!> @enden
87!>
88!> @ja
89!> @brief 2つの DC_DIFFTIME 変数の比較 (>)
90!> @details
91!> 2 つの引数の日時差を比較します.
92!> 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差
93!> よりも大きい場合, .true. が返ります.
94!>
95!> @param[in] diff1 比較する1番目の日時差
96!> @param[in] diff2 比較する2番目の日時差
97!> @return diff1 > diff2 の場合 .true., それ以外は .false.
98!> @endja
99logical function dcdatetime_gt_ff(diff1, diff2) result(result)
100
101 use dc_date_generic, only: evalsec
102 use dc_scaledsec, only: &
103 & operator(<), operator(>), operator(<=), operator(>=), operator(==)
105 implicit none
106 type(dc_difftime), intent(in):: diff1, diff2
107continue
108 if ( diff1 % day_seconds == diff2 % day_seconds ) then
109
110 if ( diff1 % mon > diff2 % mon ) then
111 result = .true. ; return
112 elseif ( diff1 % mon < diff2 % mon ) then
113 result = .false. ; return
114 end if
115 if ( diff1 % day > diff2 % day ) then
116 result = .true. ; return
117 elseif ( diff1 % day < diff2 % day ) then
118 result = .false. ; return
119 end if
120 if ( diff1 % sec > diff2 % sec ) then
121 result = .true. ; return
122 elseif ( diff1 % sec < diff2 % sec ) then
123 result = .false. ; return
124 end if
125 result = .false.
126 else
127
128 if (evalsec(diff1) > evalsec(diff2)) then
129 result = .true.
130 else
131 result = .false.
132 end if
133 end if
134end function dcdatetime_gt_ff
135
136!> @en
137!> @brief Compare DC_DIFFTIME with integer (>)
138!> @details
139!> Compare a time difference value with an integer.
140!> Returns .true. if the time difference stored in the first argument is
141!> greater than the integer stored in the second argument.
142!>
143!> @param[in] diff Time difference to compare
144!> @param[in] factor Integer value to compare
145!> @return .true. if diff > factor, .false. otherwise
146!> @enden
147!>
148!> @ja
149!> @brief DC_DIFFTIME と整数の比較 (>)
150!> @details
151!> 2 つの引数の日時差を比較します.
152!> 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差
153!> よりも大きい場合, .true. が返ります.
154!>
155!> @param[in] diff 比較する日時差
156!> @param[in] factor 比較する整数値
157!> @return diff > factor の場合 .true., それ以外は .false.
158!> @endja
159logical function dcdatetime_gt_fi(diff, factor) result(result)
160
161 use dc_date_generic, only: evalsec
162 use dc_date_types, only: dc_difftime
163 implicit none
164 type(dc_difftime), intent(in):: diff
165 integer, intent(in):: factor
166continue
167 result = evalsec(diff) > factor
168end function dcdatetime_gt_fi
169
170!> @en
171!> @brief Compare integer with DC_DIFFTIME (>)
172!> @details
173!> Compare an integer with a time difference value.
174!> Returns .true. if the integer stored in the first argument is
175!> greater than the time difference stored in the second argument.
176!>
177!> @param[in] factor Integer value to compare
178!> @param[in] diff Time difference to compare
179!> @return .true. if factor > diff, .false. otherwise
180!> @enden
181!>
182!> @ja
183!> @brief 整数と DC_DIFFTIME の比較 (>)
184!> @details
185!> 2 つの引数の日時差を比較します.
186!> 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差
187!> よりも大きい場合, .true. が返ります.
188!>
189!> @param[in] factor 比較する整数値
190!> @param[in] diff 比較する日時差
191!> @return factor > diff の場合 .true., それ以外は .false.
192!> @endja
193logical function dcdatetime_gt_if(factor, diff) result(result)
194
195 use dc_date_generic, only: evalsec
196 use dc_date_types, only: dc_difftime
197 implicit none
198 integer, intent(in):: factor
199 type(dc_difftime), intent(in):: diff
200continue
201 result = factor > evalsec(diff)
202end function dcdatetime_gt_if
logical function dcdatetime_gt_tt(time1, time2)
利用者定義演算子 (>) のための関数
logical function dcdatetime_gt_if(factor, diff)
logical function dcdatetime_gt_fi(diff, factor)
logical function dcdatetime_gt_ff(diff1, diff2)
dc_date より提供される手続の引用仕様宣言
日付・時刻に関する構造データ型と定数
精密な時間演算のための秒スケールモジュール