| Class | dc_date |
| In: |
dc_date.f90
|
日付および時刻を扱うための手続きを提供します
以下の手続きは構造型 dc_date_types#DC_DATETIME または dc_date_types#DC_DIFFTIME 変数 (日時, 時刻に関する情報を格納) を対象とします.
以下の手続きは dc_date_types 内部の変数を変更します.
| SetCaltype : | 暦法のデフォルトを変更 |
| SetSecOfDay : | 1 日の秒数のデフォルトを変更 |
その他の手続き
| ValidCaltype : | 暦法が有効なものかをチェック |
| ValidZone : | タイムゾーンとして有効化をチェック |
| ZoneToDiff : | タイムゾーンを dc_date_types#DC_DIFFTIME 変数へと変換 |
| ParseTimeUnits : | 時間の単位を解析し, 単位のシンボルを返します. |
DC_DATETIME 型の変数にサブルーチン DCDateTimeCreate を用いると, 時刻が設定されます. 下記のように特に年月日を指定しないと現在時刻が設定されます. 設定された時刻は toChar によって文字型変数へと変換できます. サブルーチン Printf に関しては dc_string#Printf を参照ください.
program dc_date_sapmle1
use dc_string, only: Printf
use dc_date_types, only: DC_DATETIME
use dc_date, only: DCDateTimeCreate, toChar
implicit none
type(DC_DATETIME) :: time
call DCDateTimeCreate( time = time ) ! (out)
call Printf( fmt = 'current date and time is %c', c1 = trim( toChar(time) ) )
end program dc_date_sapmle1
DC_DIFFTIME 型の変数は日時差を表現します. 下記の例では, 日時差を表現するための変数として diff を用意し, サブルーチン Create によって 25 日 + 12 時間 + 50 分の日時差 を設定しています. DC_DATETIME 型の変数 time_before と diff とを operator(+) によって加算することで time_before から 25 日 + 12 時間 + 50 分を進めた日時 time_after を取得しています.
program dc_date_sapmle2
use dc_types, only: DP
use dc_string, only: Printf
use dc_date_types, only: DC_DATETIME, DC_DIFFTIME
use dc_date, only: DCDateTimeCreate, DCDiffTimeCreate, toChar, operator(+)
implicit none
type(DC_DATETIME) :: time_before, time_after
type(DC_DIFFTIME) :: diff
call DCDateTimeCreate( time = time_before, & ! (out)
& year = 2006, mon = 6, day = 10, & ! (in)
& hour = 14, min = 15, sec = 0.0_DP ) ! (in)
call DCDiffTimeCreate( diff = diff, & ! (out)
& day = 25, hour = 12, min = 50) ! (in)
time_after = time_before + diff
call Printf( fmt = '%c + %c = %c', &
& c1 = trim( toChar(time_before) ), c2 = trim( toChar(diff) ), &
& c3 = trim( toChar(time_after) ) )
end program dc_date_sapmle2
以下は dA/dt = - αA (初期値 1, α=0.0001) を t = 12 (時間) まで解くプログラムの例です. 時間積分には前進差分を用いています. Δt, データの出力間隔, 計算時間に DC_DIFFTIME を用いることで, ループの終了処理や データ出力の際の時刻の比較が容易となります.
program dc_date_sapmle3
use dc_types, only: DP
use dc_date, only: DCDiffTimeCreate, EvalSec, EvalByUnit, mod, &
& operator(*), operator(==), operator(>)
use dc_date_types, only: DC_DIFFTIME
implicit none
real(DP) :: func_a = 1.0d0 ! 関数 A の初期値
real(DP), parameter :: alph = 0.0001d0 ! 係数 α
character(*), parameter :: out_unit = 'hour' ! 出力される時刻の単位
type(DC_DIFFTIME):: DelTimef, intervalf, calctimef
integer :: i
continue
call DCDiffTimeCreate( & ! Δt = 5.0 (秒)
& diff = DelTimef, & ! (out)
& value = 5.0_DP, unit = 'sec') ! (in)
call DCDiffTimeCreate( & ! データ出力間隔 = 1.0 (分)
& diff = intervalf, & ! (out)
& value = 1.0_DP, unit = 'min') ! (in)
call DCDiffTimeCreate( & ! 計算時間 = 12.0 (時間)
& diff = calctimef, & ! (out)
& value = 12.0_DP, unit = 'hour') ! (in)
open( 10, file='dc_date_sample.dat' )
write(10,'(A,A,A)') '# ', out_unit, ' value'
i = 1
do
if (DelTimef * i > calctimef) exit ! 計算時間を過ぎたら終了
!---------------------------------------------
! A_(n+1) = (1 - αΔt) * A_(n)
!---------------------------------------------
func_a = (1.0 - alph * EvalSec(DelTimef)) * func_a
!---------------------------------------------
! intervalf (1 分) 毎にデータを出力
!---------------------------------------------
if (mod(DelTimef * i, intervalf) == 0) then
write(10,*) ' ', EvalByUnit( DelTimef * i, out_unit ), func_a
end if
i = i + 1
end do
end program dc_date_sapmle3
| Subroutine : | |
| time : | type(DC_DATETIME), intent(out) |
| year : | integer, intent(in), optional |
| mon : | integer, intent(in), optional |
| day : | integer, intent(in), optional |
| hour : | integer, intent(in), optional |
| min : | integer, intent(in), optional |
| sec : | real(DP),intent(in), optional |
| zone : | character(*), intent(in), optional |
| caltype : | integer, intent(in), optional |
| day_seconds : | real(DP),intent(in), optional |
| err : | logical, intent(out), optional |
Original external subprogram is dcdatetimecreate.f90#DCDateTimeCreate1_bc
| Subroutine : | |
| diff : | type(DC_DIFFTIME), intent(out) |
| year : | integer, intent(in), optional |
| mon : | integer, intent(in), optional |
| day : | integer, intent(in), optional |
| hour : | integer, intent(in), optional |
| min : | integer, intent(in), optional |
| sec : | real(DP),intent(in), optional |
| day_seconds : | real(DP),intent(in), optional |
Original external subprogram is dcdatetimecreate.f90#DCDiffTimeCreate1_bc
| Subroutine : | |
| diff : | type(DC_DIFFTIME), intent(out) |
| value : | real(DP), intent(in) |
| unit : | character(*), intent(in) |
| err : | logical, intent(out), optional |
Original external subprogram is dcdatetimecreate.f90#DCDiffTimeCreate2_bc
| Subroutine : | |||
| time : | type(DC_DATETIME), intent(out) | ||
| year : | integer, intent(in), optional
| ||
| mon : | integer, intent(in), optional
| ||
| day : | integer, intent(in), optional
| ||
| hour : | integer, intent(in), optional
| ||
| min : | integer, intent(in), optional
| ||
| sec : | real(DP),intent(in), optional
| ||
| zone : | character(*), intent(in), optional
| ||
| caltype : | integer, intent(in), optional
| ||
| caltype_str : | character(*), intent(in), optional
| ||
| day_seconds : | real(DP),intent(in), optional
| ||
| sclyear : | type(DC_SCALED_SEC), intent(in), optional
| ||
| sclmon : | type(DC_SCALED_SEC), intent(in), optional
| ||
| sclday : | type(DC_SCALED_SEC), intent(in), optional
| ||
| sclsec : | type(DC_SCALED_SEC), intent(in), optional
| ||
| err : | logical, intent(out), optional |
dc_date_types#DC_DATETIME 型変数の生成を行います. 引数 year, mon, day, hour, min, sec の全てを与えない場合, このサブルーチンが呼ばれた際の時刻が使用されます.
引数 caltype には暦法を設定します. dc_date_types#CAL_CYCLIC, dc_date_types#CAL_NOLEAP, dc_date_types#CAL_JULIAN, dc_date_types#CAL_GREGORIAN のいづれかを与えてください. 引数 caltype を指定しない場合, 暦法は dc_date_types#CAL_GREGORIAN に設定されます. これは caltype_str に文字列を与えることでも指定可能です. 上記の暦法に対応する文字列は以下の通りです. (大文字小文字は区別しません)
dc_date_types#CAL_CYCLIC : cyclic dc_date_types#CAL_NOLEAP : noleap dc_date_types#CAL_JULIAN : julian dc_date_types#CAL_GREGORIAN : gregorian
引数 zone には UTC からの時差を設定します. ’+09:00’ や ’-13:00’ のように時差を 6 文字で指定してください. 引数 zone を指定しない場合, date_and_time 組み込みサブルーチン によって得られる時差を設定します.
引数 day_seconds には 1 日何秒かを設定します. この引数を 指定しない場合, dc_date_types#day_seconds の値が用いられます. dc_date_types#day_seconds は SetSecOfDay で変更可能です.
引数 caltype および, zone に不適切な値が与えられた場合, エラーを発生させます. 引数 err を与えている場合には err に .true. が返り, プログラムは続行します.
Original external subprogram is dcdatetimecreate.f90#DCDateTimeCreate1
| Subroutine : | |||
| time : | type(DC_DATETIME), intent(in) | ||
| unit : | integer, intent(in), optional
| ||
| indent : | character(*), intent(in), optional
|
引数 time に設定されている情報を印字します. デフォルトではメッセージは標準出力に出力されます. unit に装置番号を指定することで, 出力先を変更することが可能です.
Print information of time. By default messages are output to standard output. Unit number for output can be changed by unit argument.
Original external subprogram is dcdatetimeputline.f90#DCDateTimePutLine
| Subroutine : | |||
| diff : | type(DC_DIFFTIME), intent(out) | ||
| year : | integer, intent(in), optional
| ||
| mon : | integer, intent(in), optional
| ||
| day : | integer, intent(in), optional
| ||
| hour : | integer, intent(in), optional
| ||
| min : | integer, intent(in), optional
| ||
| sec : | real(DP), intent(in), optional
| ||
| day_seconds : | real(DP), intent(in), optional
| ||
| nondim : | real(DP), intent(in), optional
| ||
| sclyear : | type(DC_SCALED_SEC), intent(in), optional
| ||
| sclmon : | type(DC_SCALED_SEC), intent(in), optional
| ||
| sclday : | type(DC_SCALED_SEC), intent(in), optional
| ||
| sclsec : | type(DC_SCALED_SEC), intent(in), optional
|
dc_date_types#DC_DIFFTIME 型変数の生成を行います. 引数 year, mon, day, hour, min, sec, nondim を与えない場合, 0 が与えられたことになります.
引数 day_seconds には 1 日何秒かを設定します. この引数を 指定しない場合, dc_date_types#day_seconds の値が用いられます. dc_date_types#day_seconds は SetSecOfDay で変更可能です.
Original external subprogram is dcdatetimecreate.f90#DCDiffTimeCreate1
| Subroutine : | |
| diff : | type(DC_DIFFTIME), intent(out) |
| value : | real(DP), intent(in) |
| unit : | character(*), intent(in) |
| unit_symbol : | integer, intent(in), optional |
| err : | logical, intent(out), optional |
dc_date_types#DC_DIFFTIME 型変数の生成を行います. 引数 value に数値を, unit に単位を表す文字列を, または unit_symbol に単位を表すシンボルを与えてください.
unit に指定できるのは以下の文字列です. (大文字小文字は区別しません).
| 年 : | dc_date_types#UNIT_YEAR |
| 月 : | dc_date_types#UNIT_MONTH |
| 日 : | dc_date_types#UNIT_DAY |
| 時 : | dc_date_types#UNIT_HOUR |
| 分 : | dc_date_types#UNIT_MIN |
| 秒 : | dc_date_types#UNIT_SEC |
| 無次元時間 : | dc_date_types#UNIT_NONDIM |
これらに該当しない文字列を unit に与えた場合, エラーを発生させます.
unit_symbol に指定できるのは以下のシンボルです.
これらに該当しないシンボルを unit_symbol に与えた場合, エラーを発生させます.
引数 err を与えている場合には err に .true. が返り, プログラムは続行します.
Original external subprogram is dcdatetimecreate.f90#DCDiffTimeCreate2D
| Subroutine : | |
| diff : | type(DC_DIFFTIME), intent(out) |
| value : | real, intent(in) |
| unit : | character(*), intent(in) |
| unit_symbol : | integer, intent(in), optional |
| err : | logical, intent(out), optional |
Original external subprogram is dcdatetimecreate.f90#DCDiffTimeCreate2R
| Subroutine : | |
| diff : | type(DC_DIFFTIME), intent(out) |
| value : | integer, intent(in) |
| unit : | character(*), intent(in) |
| unit_symbol : | integer, intent(in), optional |
| err : | logical, intent(out), optional |
Original external subprogram is dcdatetimecreate.f90#DCDiffTimeCreate2I
| Subroutine : | |||
| diff : | type(DC_DIFFTIME), intent(in) | ||
| unit : | integer, intent(in), optional
| ||
| indent : | character(*), intent(in), optional
|
引数 diff に設定されている情報を印字します. デフォルトではメッセージは標準出力に出力されます. unit に装置番号を指定することで, 出力先を変更することが可能です.
Print information of diff. By default messages are output to standard output. Unit number for output can be changed by unit argument.
Original external subprogram is dcdatetimeputline.f90#DCDiffTimePutLine
| Subroutine : | |||
| time : | type(DC_DATETIME), intent(in) | ||
| year : | integer, intent(out), optional
| ||
| mon : | integer, intent(out), optional
| ||
| day : | integer, intent(out), optional
| ||
| hour : | integer, intent(out), optional
| ||
| min : | integer, intent(out), optional
| ||
| sec : | real(DP),intent(out), optional
| ||
| caltype : | integer, intent(out), optional
| ||
| zone : | character(*), intent(out), optional
| ||
| sclyear : | type(DC_SCALED_SEC), intent(out), optional
| ||
| sclmon : | type(DC_SCALED_SEC), intent(out), optional
| ||
| sclday : | type(DC_SCALED_SEC), intent(out), optional
| ||
| sclsec : | type(DC_SCALED_SEC), intent(out), optional
|
dc_date_types#DC_DATETIME 型変数 time を 年 year, 月 mon, 日 day, 時間 hour, 分 min, 秒 sec, 暦法 caltype, タイムゾーン zone に変換して返します.
Original external subprogram is dcdatetimeeval.f90#DCDateTimeEval1
| Subroutine : | |||
| diff : | type(DC_DIFFTIME), intent(in) | ||
| year : | integer, intent(out), optional
| ||
| mon : | integer, intent(out), optional
| ||
| day : | integer, intent(out), optional
| ||
| hour : | integer, intent(out), optional
| ||
| min : | integer, intent(out), optional
| ||
| sec : | real(DP),intent(out), optional
| ||
| nondim : | real(DP),intent(out), optional
| ||
| sclyear : | type(DC_SCALED_SEC), intent(out), optional
| ||
| sclmon : | type(DC_SCALED_SEC), intent(out), optional
| ||
| sclday : | type(DC_SCALED_SEC), intent(out), optional
| ||
| sclsec : | type(DC_SCALED_SEC), intent(out), optional
| ||
| sclnondim : | type(DC_SCALED_SEC), intent(out), optional
| ||
| err : | logical, intent(out), optional |
dc_date_types#DC_DIFFTIME 型変数 diff を 年 year, 月 mon, 日 day, 時間 hour, 分 min, 秒 sec, 無次元時間 nondim に変換して返します.
Original external subprogram is dcdatetimeeval.f90#DCDiffTimeEval1
| Function : | |
| result : | real(DP) |
| diff : | type(DC_DIFFTIME), intent(in) |
| unit : | character(*), intent(in) |
| unit_symbol : | integer, intent(in), optional |
dc_date_types#DC_DIFFTIME 型変数の日時を unit の単位 に換算して倍精度実数型変数で返します.
unit には 日 dc_date_types#UNIT_DAY, 時 dc_date_types#UNIT_HOUR, 分 dc_date_types#UNIT_MIN, 秒 dc_date_types#UNIT_SEC, 無次元時間 dc_date_types#UNIT_NONDIM を与えることが可能です.
unit_symbol には 日 dc_date_types#UNIT_SYMBOL_DAY, 時 dc_date_types#UNIT_SYMBOL_HOUR, 分 dc_date_types#UNIT_SYMBOL_MIN, 秒 dc_date_types#UNIT_SYMBOL_SEC 無次元時間 dc_date_types#UNIT_SYMBOL_NONDIM を与えることが可能です.
これらに該当しないものを unit または unit_symbol に与えた場合, もしくは引数を両方とも与えない場合, 0.0 が返ります.
Original external subprogram is dcdatetimeeval.f90#DCDiffTimeEvalByUnit
| Function : | |
| result : | real(DP) |
| time : | type(DC_DATETIME), intent(in) |
| unit : | character(*), intent(in) |
| unit_symbol : | integer, intent(in), optional |
dc_date_types#DC_DATETIME 型変数の日時を unit または unit_symbol の単位 に換算して倍精度実数型変数で返します.
unit には 日 dc_date_types#UNIT_DAY, 時 dc_date_types#UNIT_HOUR, 分 dc_date_types#UNIT_MIN, 秒 dc_date_types#UNIT_SEC を与えることが可能です.
unit_symbol には 日 dc_date_types#UNIT_SYMBOL_DAY, 時 dc_date_types#UNIT_SYMBOL_HOUR, 分 dc_date_types#UNIT_SYMBOL_MIN, 秒 dc_date_types#UNIT_SYMBOL_SEC を与えることが可能です.
これらに該当しないものを unit または unit_symbol に与えた場合, もしくは引数を両方とも与えない場合, 0.0 が返ります.
Original external subprogram is dcdatetimeeval.f90#DCDateTimeEvalByUnit
| Function : | |
| result : | real(DP) |
| time : | type(DC_DATETIME), intent(in) |
dc_date_types#DC_DATETIME 型変数の日時を日数に換算して 倍精度実数型変数で返します. (例えば 12 時間は 0.5 日と換算されます).
Original external subprogram is dcdatetimeeval.f90#DCDateTimeEvalDay
| Function : | |
| result : | real(DP) |
| diff : | type(DC_DIFFTIME), intent(in) |
dc_date_types#DC_DIFFTIME 型変数の日時を日数に換算して 倍精度実数型変数で返します. (例えば 12 時間は 0.5 日と換算されます).
1 ヶ月は dc_date_types#CYCLIC_MDAYS と換算します.
Original external subprogram is dcdatetimeeval.f90#DCDiffTimeEvalDay
| Function : | |
| result : | real(DP) |
| time : | type(DC_DATETIME), intent(in) |
dc_date_types#DC_DATETIME 型変数の日時を時間に換算して 倍精度実数型変数で返します. (例えば 2 日は 48 時間に, 30 分 は 0.5 時間と換算されます).
Original external subprogram is dcdatetimeeval.f90#DCDateTimeEvalHour
| Function : | |
| result : | real(DP) |
| diff : | type(DC_DIFFTIME), intent(in) |
dc_date_types#DC_DIFFTIME 型変数の日時を時間に換算して 倍精度実数型変数で返します. (例えば 2 日は 48 時間に, 30 分 は 0.5 時間と換算されます).
1 ヶ月は dc_date_types#CYCLIC_MDAYS と換算します.
Original external subprogram is dcdatetimeeval.f90#DCDiffTimeEvalHour
| Function : | |
| result : | real(DP) |
| time : | type(DC_DATETIME), intent(in) |
dc_date_types#DC_DATETIME 型変数の日時を分に換算して 倍精度実数型変数で返します. (例えば 1 日は 3600 分に, 30 秒 は 0.5 分と換算されます).
Original external subprogram is dcdatetimeeval.f90#DCDateTimeEvalMin
| Function : | |
| result : | real(DP) |
| diff : | type(DC_DIFFTIME), intent(in) |
dc_date_types#DC_DIFFTIME 型変数の日時を分に換算して 倍精度実数型変数で返します. (例えば 1 日は 3600 分に, 30 秒 は 0.5 分と換算されます).
1 ヶ月は dc_date_types#CYCLIC_MDAYS と換算します.
Original external subprogram is dcdatetimeeval.f90#DCDiffTimeEvalMin
| Function : | |
| result : | real(DP) |
| diff : | type(DC_DIFFTIME), intent(in) |
dc_date_types#DC_DIFFTIME 型変数の日時を無時限時間に換算して 倍精度実数型変数で返します.
1 ヶ月は dc_date_types#CYCLIC_MDAYS と換算します.
Original external subprogram is dcdatetimeeval.f90#DCDiffTimeEvalNondim
| Function : | |
| result : | real(DP) |
| time : | type(DC_DATETIME), intent(in) |
dc_date_types#DC_DATETIME 型変数の日時を秒に換算して 倍精度実数型変数で返します.
年の要素は無視されます. すなわち, 1999-01-01 が格納された time と 2007-01-01 が格納された time からは同じ値が返ります. (これはもしかすると望ましく無い動作かもしれません).
Original external subprogram is dcdatetimeeval.f90#DCDateTimeEvalSec
| Function : | |
| result : | real(DP) |
| diff : | type(DC_DIFFTIME), intent(in) |
dc_date_types#DC_DIFFTIME 型変数の日時を秒に換算して 倍精度実数型変数で返します.
1 ヶ月は dc_date_types#CYCLIC_MDAYS と換算します.
Original external subprogram is dcdatetimeeval.f90#DCDiffTimeEvalSec
| Function : | |
| symbol : | integer |
| str : | character(*), intent(in) |
引数 str に与えられた文字列を解釈し, 日時の単位を示す シンボルを返します. それぞれ以下の文字列が日時の単位として解釈されます. 大文字と小文字は区別されません.
| 年 : | dc_date_types#UNIT_YEAR |
| 月 : | dc_date_types#UNIT_MONTH |
| 日 : | dc_date_types#UNIT_DAY |
| 時 : | dc_date_types#UNIT_HOUR |
| 分 : | dc_date_types#UNIT_MIN |
| 秒 : | dc_date_types#UNIT_SEC |
| 無次元時間 : | dc_date_types#UNIT_NONDIM |
返るシンボル (整数型) は以下の通りです.
これらに該当しない文字列を str に与えた場合, dc_date_types#UNIT_SYMBOL_ERR が返ります.
function ParseTimeUnits(str) result(symbol)
!
! 引数 *str* に与えられた文字列を解釈し, 日時の単位を示す
! シンボルを返します. それぞれ以下の文字列が日時の単位として解釈されます.
! 大文字と小文字は区別されません.
!
! 年 :: dc_date_types#UNIT_YEAR
! 月 :: dc_date_types#UNIT_MONTH
! 日 :: dc_date_types#UNIT_DAY
! 時 :: dc_date_types#UNIT_HOUR
! 分 :: dc_date_types#UNIT_MIN
! 秒 :: dc_date_types#UNIT_SEC
! 無次元時間 :: dc_date_types#UNIT_NONDIM
!
! 返るシンボル (整数型) は以下の通りです.
!
! 年 :: dc_date_types#UNIT_SYMBOL_YEAR
! 月 :: dc_date_types#UNIT_SYMBOL_MONTH
! 日 :: dc_date_types#UNIT_SYMBOL_DAY
! 時 :: dc_date_types#UNIT_SYMBOL_HOUR
! 分 :: dc_date_types#UNIT_SYMBOL_MIN
! 秒 :: dc_date_types#UNIT_SYMBOL_SEC
! 無次元時間 :: dc_date_types#UNIT_SYMBOL_NONDIM
!
! これらに該当しない文字列を *str* に与えた場合,
! dc_date_types#UNIT_SYMBOL_ERR が返ります.
!
use dc_types, only: TOKEN
use dc_date_types, only: UNIT_YEAR, UNIT_MONTH, UNIT_DAY, UNIT_HOUR, UNIT_MIN, UNIT_SEC, UNIT_NONDIM, UNIT_SYMBOL_YEAR, UNIT_SYMBOL_MONTH, UNIT_SYMBOL_DAY, UNIT_SYMBOL_HOUR, UNIT_SYMBOL_MIN, UNIT_SYMBOL_SEC, UNIT_SYMBOL_NONDIM, UNIT_SYMBOL_ERR
use dc_string, only: StriEq
implicit none
character(*), intent(in):: str
integer:: symbol
integer:: unit_str_size, i
character(TOKEN):: unit
continue
unit = adjustl(str)
unit_str_size = size(UNIT_NONDIM)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_NONDIM(i)))) then
symbol = UNIT_SYMBOL_NONDIM
return
end if
end do
unit_str_size = size(UNIT_SEC)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_SEC(i)))) then
symbol = UNIT_SYMBOL_SEC
return
end if
end do
unit_str_size = size(UNIT_MIN)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_MIN(i)))) then
symbol = UNIT_SYMBOL_MIN
return
end if
end do
unit_str_size = size(UNIT_HOUR)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_HOUR(i)))) then
symbol = UNIT_SYMBOL_HOUR
return
end if
end do
unit_str_size = size(UNIT_DAY)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_DAY(i)))) then
symbol = UNIT_SYMBOL_DAY
return
end if
end do
unit_str_size = size(UNIT_MONTH)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_MONTH(i)))) then
symbol = UNIT_SYMBOL_MONTH
return
end if
end do
unit_str_size = size(UNIT_YEAR)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_YEAR(i)))) then
symbol = UNIT_SYMBOL_YEAR
return
end if
end do
symbol = UNIT_SYMBOL_ERR
end function ParseTimeUnits
| Subroutine : | |
| diff : | type(DC_DIFFTIME), intent(in) |
| unit : | integer, intent(in), optional |
Original external subprogram is dcdatetimeputline.f90#DCDiffTimePutLine_bc
| Subroutine : | |
| time : | type(DC_DATETIME), intent(in) |
| unit : | integer, intent(in), optional |
Original external subprogram is dcdatetimeputline.f90#DCDateTimePutLine_bc
| Subroutine : | |
| caltype : | integer, intent(in) |
暦法のデフォルトを設定します. dc_date_types#CAL_CYCLIC, dc_date_types#CAL_NOLEAP, dc_date_types#CAL_JULIAN, dc_date_types#CAL_GREGORIAN のいづれかを引数 caltype に与えてください.
なお, この手続きを呼ばない場合, デフォルトの暦法は dc_date_types#CAL_GREGORIAN に設定されています.
Original external subprogram is dcdatetimesetcaltype.f90#DCDateTimeSetCaltype
| Subroutine : | |
| sec : | real(DP), intent(in) |
1 日の秒数のデフォルトを設定します.
なお, この手続きを呼ばない場合, デフォルトの 1 日の秒数は dc_date_types#DAY_SECONDS_EARTH に設定されています.
Original external subprogram is dcdatetimesetsecofday.f90#DCDateTimeSetSecOfDay
| Subroutine : | |
| time : | type(DC_DATETIME), intent(inout) |
| zone : | character(*), intent(in) |
| err : | logical, intent(out), optional |
引数 time のタイムゾーンを zone へと変更します. 実質的な日時は変更しません.
引数 zone に不適切な値が与えられた場合, エラーを発生させます. 引数 err を与えている場合には err に .true. が返り, プログラムは続行します.
Original external subprogram is dcdatetimezone.f90#DCDateTimeSetZone
| Function : | |
| result : | logical |
| caltype : | integer, intent(in) |
与えられる暦法が dc_date_types 内で有効であれば .true. を, それ以外の場合は .false. を返します.
Original external subprogram is dcdatetimevalidcaltype.f90#DCDateTimeValidCaltype
| Function : | |
| result : | logical |
| zone : | character(*), intent(in) |
与えられるタイムゾーンの表記が有効であれば .true. を, それ以外の場合は .false. を返します.
タイムゾーンの表記は ’+09:00’ のように, 1 文字目が ’+’ または ’-’, 2〜3, 5〜6 文字目が数値で, 4 文字目が ’:’ となります.
Original external subprogram is dcdatetimezone.f90#DCDateTimeValidZone
| Function : | |
| diff : | type(DC_DIFFTIME) |
| zone : | character(*), intent(in) |
与えられるタイムゾーンを dc_date_types#DC_DIFFTIME 変数へと 変換して返します. タイムゾーンの表記が無効な場合は ’+00:00’ が与えられたと解釈します.
Original external subprogram is dcdatetimezone.f90#DCDateTimeZoneToDiff
| Subroutine : | |
| time : | type(DC_DATETIME), intent(out) |
| sec : | integer, intent(in) |
dc_date_types#DC_DATETIME 型変数の生成を行います. 引数 sec には秒数を与えてください. 年月日, 時分を使って 指定を行いたい場合は Create を利用してください.
Original external subprogram is dcdatetimecreate.f90#DCDateTimeCreateI
| Subroutine : | |
| time : | type(DC_DATETIME), intent(out) |
| sec : | real, intent(in) |
dc_date_types#DC_DATETIME 型変数の生成を行います. 引数 sec には秒数を与えてください. 年月日, 時分を使って 指定を行いたい場合は Create を利用してください.
Original external subprogram is dcdatetimecreate.f90#DCDateTimeCreateR
| Subroutine : | |
| time : | type(DC_DATETIME), intent(out) |
| sec : | real(DP), intent(in) |
Original external subprogram is dcdatetimecreate.f90#DCDateTimeCreateD
| Subroutine : | |
| diff : | type(DC_DIFFTIME), intent(out) |
| sec : | integer, intent(in) |
dc_date_types#DC_DIFFTIME 型変数の生成を行います. 引数 sec には秒数を与えてください. 年月日, 時分を使って 指定を行いたい場合は Create を利用してください.
Original external subprogram is dcdatetimecreate.f90#DCDiffTimeCreateI
| Subroutine : | |
| diff : | type(DC_DIFFTIME), intent(out) |
| sec : | real, intent(in) |
dc_date_types#DC_DIFFTIME 型変数の生成を行います. 引数 sec には秒数を与えてください. 年月日, 時分を使って 指定を行いたい場合は Create を利用してください.
Original external subprogram is dcdatetimecreate.f90#DCDiffTimeCreateR
| Subroutine : | |
| diff : | type(DC_DIFFTIME), intent(out) |
| sec : | real(DP), intent(in) |
Original external subprogram is dcdatetimecreate.f90#DCDiffTimeCreateD
| Subroutine : | |
| day : | type(DC_SCALED_SEC), intent(inout) |
| sec : | type(DC_SCALED_SEC), intent(inout) |
| day_seconds : | type(DC_SCALED_SEC), intent(in), optional |
| nondim_flag : | logical, intent(in) |
このサブルーチンは内部向けなので dc_date モジュール外では 極力使用しないでください.
日付 day と秒数 sec の正規化を行います. sec が day_seconds (省略される場合は dc_date_types#day_seconds) を超える場合, day に繰上げを行います. また, sec と day の符号が逆の場合, 同符号になるよう 設定します.
subroutine dcdate_normalize(day, sec, day_seconds, nondim_flag)
!
!=== 日と秒の正規化
!
! このサブルーチンは内部向けなので dc_date モジュール外では
! 極力使用しないでください.
!
! 日付 *day* と秒数 *sec* の正規化を行います. *sec* が *day_seconds*
! (省略される場合は dc_date_types#day_seconds) を超える場合, *day*
! に繰上げを行います.
! また, *sec* と *day* の符号が逆の場合, 同符号になるよう
! 設定します.
!
use dc_date_types, only: flag_set_day_seconds_scl, day_seconds_scl
use dc_scaledsec, only: DC_SCALED_SEC, operator(<), operator(>), operator(<=), operator(>=), operator(+), operator(-), operator(*), operator(/), modulo, int, abs, sign
implicit none
type(DC_SCALED_SEC), intent(inout):: day
type(DC_SCALED_SEC), intent(inout):: sec
type(DC_SCALED_SEC), intent(in), optional:: day_seconds
logical, intent(in):: nondim_flag
type(DC_SCALED_SEC):: sgn, day_sec, zero_sec
continue
if ( nondim_flag ) return
if (present(day_seconds)) then
day_sec = day_seconds
else
if ( .not. flag_set_day_seconds_scl ) call dcdate_set_day_seconds_scl
day_sec = day_seconds_scl
end if
if (abs(sec) >= day_sec) then
day = day + int(sec / day_sec)
sec = modulo(sec, day_sec)
end if
!! zero_sec = 0 (デフォルト値 = 0 を使用する).
if ( ( sec > zero_sec .and. day < zero_sec ) .or. ( sec < zero_sec .and. day > zero_sec ) ) then
sgn = sign(day, 1)
day = day - sgn
sec = sec + sgn * day_sec
endif
end subroutine dcdate_normalize
| Function : | |
| unit : | character(TOKEN) |
| str : | character(*), intent(in) |
このサブルーチンは内部向けなので dc_date モジュール外では 極力使用しないでください.
引数 str に与えられた文字列を解釈し, 日時の単位を 返します. それぞれ以下の文字列が日時の単位として解釈されます. 大文字と小文字は区別されません. 返る文字列は以下の文字型の配列の先頭の文字列です. (例: str に ‘hrs.’ が与えられる場合, dc_date_types#UNIT_HOUR 配列の先頭の文字列 UNIT_HOUR(1) が返ります.)
| 年 : | dc_date_types#UNIT_YEAR |
| 月 : | dc_date_types#UNIT_MONTH |
| 日 : | dc_date_types#UNIT_DAY |
| 時 : | dc_date_types#UNIT_HOUR |
| 分 : | dc_date_types#UNIT_MIN |
| 秒 : | dc_date_types#UNIT_SEC |
| 無次元時間 : | dc_date_types#UNIT_NONDIM |
これらに該当しない文字列を str に与えた場合, 空文字が返ります.
character(TOKEN) function dcdate_parse_unit(str) result(unit)
!
! このサブルーチンは内部向けなので dc_date モジュール外では
! 極力使用しないでください.
!
! 引数 *str* に与えられた文字列を解釈し, 日時の単位を
! 返します. それぞれ以下の文字列が日時の単位として解釈されます.
! 大文字と小文字は区別されません.
! 返る文字列は以下の文字型の配列の先頭の文字列です.
! (例: *str* に 'hrs.' が与えられる場合, dc_date_types#UNIT_HOUR
! 配列の先頭の文字列 UNIT_HOUR(1) が返ります.)
!
! 年 :: dc_date_types#UNIT_YEAR
! 月 :: dc_date_types#UNIT_MONTH
! 日 :: dc_date_types#UNIT_DAY
! 時 :: dc_date_types#UNIT_HOUR
! 分 :: dc_date_types#UNIT_MIN
! 秒 :: dc_date_types#UNIT_SEC
! 無次元時間 :: dc_date_types#UNIT_NONDIM
!
! これらに該当しない文字列を *str* に与えた場合, 空文字が返ります.
!
use dc_types, only: TOKEN
use dc_date_types, only: UNIT_YEAR, UNIT_MONTH, UNIT_DAY, UNIT_HOUR, UNIT_MIN, UNIT_SEC, UNIT_NONDIM
use dc_string, only: StriEq
implicit none
character(*), intent(in):: str
integer :: unit_str_size, i
continue
unit = adjustl(str)
unit_str_size = size(UNIT_NONDIM)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_NONDIM(i)))) then
unit = UNIT_NONDIM(1)
return
end if
end do
unit_str_size = size(UNIT_SEC)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_SEC(i)))) then
unit = UNIT_SEC(1)
return
end if
end do
unit_str_size = size(UNIT_MIN)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_MIN(i)))) then
unit = UNIT_MIN(1)
return
end if
end do
unit_str_size = size(UNIT_HOUR)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_HOUR(i)))) then
unit = UNIT_HOUR(1)
return
end if
end do
unit_str_size = size(UNIT_DAY)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_DAY(i)))) then
unit = UNIT_DAY(1)
return
end if
end do
unit_str_size = size(UNIT_MONTH)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_MONTH(i)))) then
unit = UNIT_MONTH(1)
return
end if
end do
unit_str_size = size(UNIT_YEAR)
do i = 1, unit_str_size
if (StriEq(trim(unit), trim(UNIT_YEAR(i)))) then
unit = UNIT_YEAR(1)
return
end if
end do
unit = ''
end function dcdate_parse_unit
| Subroutine : |
subroutine dcdate_set_day_seconds_scl
use dc_scaledsec, only: DC_SCALED_SEC, assignment(=)
use dc_date_types, only: day_seconds, flag_set_day_seconds_scl, day_seconds_scl
continue
if ( .not. flag_set_day_seconds_scl ) then
flag_set_day_seconds_scl = .true.
day_seconds_scl = day_seconds
end if
end subroutine dcdate_set_day_seconds_scl
| Function : | |
| result : | type(DC_DATETIME) |
| time1 : | type(DC_DATETIME), intent(in) |
| time2 : | type(DC_DATETIME), intent(in) |
2 つの引数の日時を比較し, より日時が進んでいる方を返します.
type(DC_DATETIME) function dcdate_max_tt(time1, time2) result(result)
!
! 2 つの引数の日時を比較し, より日時が進んでいる方を返します.
!
implicit none
type(DC_DATETIME), intent(in):: time1, time2
continue
if ( time1 > time2 ) then
result = time1
else
result = time2
end if
end function dcdate_max_tt
| Function : | |
| result : | type(DC_DIFFTIME) |
| diff1 : | type(DC_DIFFTIME), intent(in) |
| diff2 : | type(DC_DIFFTIME), intent(in) |
2 つの引数の日時差を比較し, より大きい方を返します.
type(DC_DIFFTIME) function dcdate_max_ff(diff1, diff2) result(result)
!
! 2 つの引数の日時差を比較し, より大きい方を返します.
!
implicit none
type(DC_DIFFTIME), intent(in):: diff1, diff2
continue
if ( diff1 > diff2 ) then
result = diff1
else
result = diff2
end if
call dcdate_nondimcheck('dc_date#max', diff1, diff2, result)
end function dcdate_max_ff
| Function : | |
| result : | type(DC_DATETIME) |
| time1 : | type(DC_DATETIME), intent(in) |
| time2 : | type(DC_DATETIME), intent(in) |
2 つの引数の日時を比較し, より日時が遅れている方を返します.
type(DC_DATETIME) function dcdate_min_tt(time1, time2) result(result)
!
! 2 つの引数の日時を比較し, より日時が遅れている方を返します.
!
implicit none
type(DC_DATETIME), intent(in):: time1, time2
continue
if ( time1 < time2 ) then
result = time1
else
result = time2
end if
end function dcdate_min_tt
| Function : | |
| result : | type(DC_DIFFTIME) |
| diff1 : | type(DC_DIFFTIME), intent(in) |
| diff2 : | type(DC_DIFFTIME), intent(in) |
2 つの引数の日時差を比較し, より小さい方を返します.
type(DC_DIFFTIME) function dcdate_min_ff(diff1, diff2) result(result)
!
! 2 つの引数の日時差を比較し, より小さい方を返します.
!
implicit none
type(DC_DIFFTIME), intent(in):: diff1, diff2
continue
if ( diff1 < diff2 ) then
result = diff1
else
result = diff2
end if
call dcdate_nondimcheck('dc_date#min', diff1, diff2, result)
end function dcdate_min_ff
| Function : | |
| result : | type(DC_DIFFTIME) |
| diff1 : | type(DC_DIFFTIME), intent(in) |
| diff2 : | type(DC_DIFFTIME), intent(in) |
引数 diff1 を diff2 で除算した際の余りを返します.
※ 注意: 月差と日時の混在する除算は近似的結果になるおそれがあります
type(DC_DIFFTIME) function dcdate_mod_ff(diff1, diff2) result(result)
!
! 引数 <b>diff1</b> を <b>diff2</b> で除算した際の余りを返します.
!
! ※ 注意: 月差と日時の混在する除算は近似的結果になるおそれがあります
!
use dc_date_types, only: CYCLIC_MDAYS
use dc_scaledsec, only: DC_SCALED_SEC, operator(==), operator(<), operator(>), operator(<=), operator(>=), operator(+), operator(-), operator(*), operator(/), mod, modulo, int, abs, sign
implicit none
type(DC_DIFFTIME), intent(in):: diff1, diff2
type(DC_SCALED_SEC):: sec1, sec2
type(DC_SCALED_SEC):: zero_sec
continue
result % day_seconds = diff1 % day_seconds
if (diff1 % day == zero_sec .and. diff2 % day == zero_sec .and. diff1 % sec == zero_sec .and. diff2 % sec == zero_sec) then
result % mon = mod(diff1 % mon, diff2 % mon)
result % day = zero_sec
result % sec = zero_sec
else if (diff1 % sec == zero_sec .and. diff2 % sec == zero_sec) then
result % mon = zero_sec
result % day = mod((CYCLIC_MDAYS * diff1 % mon + diff1 % day), (CYCLIC_MDAYS * diff2 % mon + diff2 % day))
result % sec = zero_sec
else
sec1 = diff1 % day_seconds * (CYCLIC_MDAYS * diff1 % mon + diff1 % day) + diff1 % sec
sec2 = diff2 % day_seconds * (CYCLIC_MDAYS * diff2 % mon + diff2 % day) + diff2 % sec
result % sec = mod(sec1, sec2)
result % day = zero_sec
result % mon = zero_sec
call dcdate_normalize(result % day, result % sec, result % day_seconds, result % nondim_flag)
endif
call dcdate_nondimcheck('dc_date#mod', diff1, diff2, result)
end function dcdate_mod_ff
| Function : | |
| result : | type(DC_DIFFTIME) |
| factor : | integer, intent(in) |
| diff : | type(DC_DIFFTIME), intent(in) |
日時差 diff と facter とを乗算した結果を返します.
type(DC_DIFFTIME) function dcdate_mul_if(factor, diff) result(result)
!
! 日時差 *diff* と *facter* とを乗算した結果を返します.
!
use dc_scaledsec, only: operator(*)
implicit none
integer, intent(in):: factor
type(DC_DIFFTIME), intent(in):: diff
continue
result % mon = factor * diff % mon
result % day = factor * diff % day
result % sec = factor * diff % sec
result % day_seconds = diff % day_seconds
result % nondim_flag = diff % nondim_flag
call dcdate_normalize(result % day, result % sec, result % day_seconds, result % nondim_flag)
end function dcdate_mul_if
| Function : | |
| result : | type(DC_DIFFTIME) |
| diff : | type(DC_DIFFTIME), intent(in) |
| factor : | integer, intent(in) |
type(DC_DIFFTIME) function dcdate_mul_fi(diff, factor) result(result)
implicit none
type(DC_DIFFTIME), intent(in):: diff
integer, intent(in):: factor
continue
result = dcdate_mul_if(factor, diff)
end function dcdate_mul_fi
| Function : | |
| result : | type(DC_DIFFTIME) |
| factor : | real, intent(in) |
| diff : | type(DC_DIFFTIME), intent(in) |
※ 注意 : 月差を非整数倍すると近似的結果になるおそれがあります
type(DC_DIFFTIME) function dcdate_mul_rf(factor, diff) result(result)
!
! ※ 注意 : 月差を非整数倍すると近似的結果になるおそれがあります
use dc_types, only: DP
implicit none
real, intent(in):: factor
type(DC_DIFFTIME), intent(in):: diff
continue
result = dcdate_mul_df(real(factor, DP), diff)
end function dcdate_mul_rf
| Function : | |
| result : | type(DC_DIFFTIME) |
| diff : | type(DC_DIFFTIME), intent(in) |
| factor : | real, intent(in) |
※ 注意 : 月差を非整数倍すると近似的結果になるおそれがあります
type(DC_DIFFTIME) function dcdate_mul_fr(diff, factor) result(result)
!
! ※ 注意 : 月差を非整数倍すると近似的結果になるおそれがあります
implicit none
type(DC_DIFFTIME), intent(in):: diff
real, intent(in):: factor
continue
result = dcdate_mul_rf(factor, diff)
end function dcdate_mul_fr
| Function : | |
| result : | type(DC_DIFFTIME) |
| factor : | real(DP), intent(in) |
| diff : | type(DC_DIFFTIME), intent(in) |
※ 注意 : 月差を非整数倍すると近似的結果になるおそれがあります
type(DC_DIFFTIME) function dcdate_mul_df(factor, diff) result(result)
!
! ※ 注意 : 月差を非整数倍すると近似的結果になるおそれがあります
use dc_types, only: DP
use dc_date_types, only: CYCLIC_MDAYS
use dc_scaledsec, only: DC_SCALED_SEC, operator(<), operator(>), operator(<=), operator(>=), operator(+), operator(-), operator(*), operator(/), modulo, int, abs, sign
implicit none
real(DP), intent(in):: factor
type(DC_DIFFTIME), intent(in):: diff
type(DC_SCALED_SEC):: month, day
continue
month = factor * diff % mon
result % mon = int(month)
day = factor * diff % day + int(CYCLIC_MDAYS * (month - result % mon))
result % day = int(day)
result % sec = factor * diff % sec + (day - result % day) * diff % day_seconds
result % day_seconds = diff % day_seconds
result % nondim_flag = diff % nondim_flag
call dcdate_normalize(result % day, result % sec, result % day_seconds, result % nondim_flag)
end function dcdate_mul_df
| Function : | |
| result : | type(DC_DIFFTIME) |
| diff : | type(DC_DIFFTIME), intent(in) |
| factor : | real(DP), intent(in) |
※ 注意 : 月差を非整数倍すると近似的結果になるおそれがあります
type(DC_DIFFTIME) function dcdate_mul_fd(diff, factor) result(result)
!
! ※ 注意 : 月差を非整数倍すると近似的結果になるおそれがあります
use dc_types, only: DP
implicit none
type(DC_DIFFTIME), intent(in):: diff
real(DP), intent(in):: factor
continue
result = dcdate_mul_df(factor, diff)
end function dcdate_mul_fd
| Function : | |
| result : | type(DC_DATETIME) |
| diff : | type(DC_DIFFTIME), intent(in) |
| time : | type(DC_DATETIME), intent(in) |
2 つの日時 (DC_DATETIME 型) もしくは 日時差 (DC_DIFFTIME 型)の加算を行います.
type(DC_DATETIME) function dcdate_add_ft(diff, time) result(result)
!
! 2 つの日時 (DC_DATETIME 型) もしくは
! 日時差 (DC_DIFFTIME 型)の加算を行います.
!
use dc_scaledsec, only: DC_SCALED_SEC, operator(<), operator(>), operator(<=), operator(>=), operator(+), operator(-), operator(*), operator(/), modulo, int, abs, sign
implicit none
type(DC_DIFFTIME), intent(in):: diff
type(DC_DATETIME), intent(in):: time
type(DC_SCALED_SEC):: time_year, time_mon, time_day, time_sec
integer:: time_caltype
character(6):: time_zone
continue
call Eval(time, sclyear = time_year, sclmon = time_mon, sclday = time_day, sclsec = time_sec, caltype = time_caltype, zone = time_zone)
call DCDateTimeCreate(result, sclyear = time_year, sclmon = time_mon + diff % mon, sclday = time_day + diff % day, sclsec = time_sec + diff % sec, caltype = time_caltype, zone = time_zone)
end function dcdate_add_ft
| Function : | |
| result : | type(DC_DIFFTIME) |
| diff1 : | type(DC_DIFFTIME), intent(in) |
| diff2 : | type(DC_DIFFTIME), intent(in) |
type(DC_DIFFTIME) function dcdate_add_ff(diff1, diff2) result(result)
use dc_scaledsec, only: operator(+)
implicit none
type(DC_DIFFTIME), intent(in):: diff1, diff2
continue
result % mon = diff1 % mon + diff2 % mon
result % day = diff1 % day + diff2 % day
result % sec = diff1 % sec + diff2 % sec
result % day_seconds = diff1 % day_seconds
call dcdate_nondimcheck('dc_date#operator(+)', diff1, diff2, result)
call dcdate_normalize(result % day, result % sec, result % day_seconds, result % nondim_flag)
end function dcdate_add_ff
| Function : | |
| result : | type(DC_DATETIME) |
| time : | type(DC_DATETIME), intent(in) |
| diff : | type(DC_DIFFTIME), intent(in) |
type(DC_DATETIME) function dcdate_add_tf(time, diff) result(result)
use dc_types, only: DP
implicit none
type(DC_DATETIME), intent(in):: time
type(DC_DIFFTIME), intent(in):: diff
continue
result = dcdate_add_ft(diff, time)
end function dcdate_add_tf
| Function : | |
| result : | type(DC_DATETIME) |
| time : | type(DC_DATETIME), intent(in) |
| diff : | type(DC_DIFFTIME), intent(in) |
2 つの日時 (DC_DATETIME 型) もしくは 日時差 (DC_DIFFTIME 型)の減算を行います.
type(DC_DATETIME) function dcdate_sub_tf(time, diff) result(result)
!
! 2 つの日時 (DC_DATETIME 型) もしくは
! 日時差 (DC_DIFFTIME 型)の減算を行います.
!
use dc_scaledsec, only: DC_SCALED_SEC, operator(<), operator(>), operator(<=), operator(>=), operator(+), operator(-), operator(*), operator(/), modulo, int, abs, sign
implicit none
type(DC_DATETIME), intent(in):: time
type(DC_DIFFTIME), intent(in):: diff
type(DC_SCALED_SEC):: time_year, time_mon, time_day, time_sec
integer:: time_caltype
character(6):: time_zone
continue
call Eval(time, sclyear = time_year, sclmon = time_mon, sclday = time_day, sclsec = time_sec, caltype = time_caltype, zone = time_zone )
call DCDateTimeCreate(result, sclyear = time_year, sclmon = time_mon - diff % mon, sclday = time_day - diff % day, sclsec = time_sec - diff % sec, caltype = time_caltype, zone = time_zone)
end function dcdate_sub_tf
| Function : | |
| result : | type(DC_DIFFTIME) |
| diff1 : | type(DC_DIFFTIME), intent(in) |
| diff2 : | type(DC_DIFFTIME), intent(in) |
type(DC_DIFFTIME) function dcdate_sub_ff(diff1, diff2) result(result)
use dc_scaledsec, only: operator(-)
implicit none
type(DC_DIFFTIME), intent(in):: diff1, diff2
continue
result % mon = diff1 % mon - diff2 % mon
result % day = diff1 % day - diff2 % day
result % sec = diff1 % sec - diff2 % sec
result % day_seconds = diff1 % day_seconds
call dcdate_nondimcheck('dc_date#operator(-)', diff1, diff2, result)
call dcdate_normalize(result % day, result % sec, result % day_seconds, result % nondim_flag)
end function dcdate_sub_ff
| Function : | |
| result : | type(DC_DIFFTIME) |
| time1 : | type(DC_DATETIME), intent(in) |
| time2 : | type(DC_DATETIME), intent(in) |
type(DC_DIFFTIME) function dcdate_sub_tt(time1, time2) result(result)
use dc_scaledsec, only: DC_SCALED_SEC, operator(<), operator(>), operator(<=), operator(>=), operator(+), operator(-), operator(*), operator(/), modulo, int, abs, sign
implicit none
type(DC_DATETIME), intent(in):: time1, time2
continue
result % day = time1 % day - time2 % day
result % sec = time1 % sec - time2 % sec + EvalSclSec(ZoneToDiff(time1 % zone) - ZoneToDiff(time2 % zone))
result % day_seconds = time1 % day_seconds
call dcdate_normalize(result % day, result % sec, result % day_seconds, result % nondim_flag)
end function dcdate_sub_tt
| Function : | |
| result : | type(DC_DIFFTIME) |
| diff : | type(DC_DIFFTIME), intent(in) |
| denominator : | integer, intent(in) |
日時差 diff を denominator で除算した結果を返します.
※ 注意 : 月差を除算すると近似的結果になるおそれがあります
type(DC_DIFFTIME) function dcdate_div_fi(diff, denominator) result(result)
!
! 日時差 *diff* を *denominator* で除算した結果を返します.
!
! ※ 注意 : 月差を除算すると近似的結果になるおそれがあります
use dc_date_types, only: CYCLIC_MDAYS
use dc_scaledsec, only: DC_SCALED_SEC, operator(<), operator(>), operator(<=), operator(>=), operator(+), operator(-), operator(*), operator(/), mod, modulo, int, abs, sign
implicit none
type(DC_DIFFTIME), intent(in):: diff
integer, intent(in):: denominator
continue
result % mon = int( diff % mon / denominator )
! 月からの近似的繰り下がりは日単位でしか行わない
result % day = int( diff % day / denominator ) + int( (CYCLIC_MDAYS * mod(diff % mon, denominator)) / denominator )
result % sec = diff % sec / denominator + (diff % day_seconds * mod(diff % day, denominator)) / denominator
result % nondim_flag = diff % nondim_flag
end function dcdate_div_fi
| Function : | |
| result : | type(DC_DIFFTIME) |
| diff : | type(DC_DIFFTIME), intent(in) |
| denominator : | real(DP), intent(in) |
※ 注意 : 月差を除算すると近似的結果になるおそれがあります
type(DC_DIFFTIME) function dcdate_div_fd(diff, denominator) result(result)
!
! ※ 注意 : 月差を除算すると近似的結果になるおそれがあります
use dc_date_types, only: CYCLIC_MDAYS
use dc_scaledsec, only: DC_SCALED_SEC, operator(<), operator(>), operator(<=), operator(>=), operator(+), operator(-), operator(*), operator(/), modulo, int, abs, sign
implicit none
type(DC_DIFFTIME), intent(in):: diff
real(DP), intent(in):: denominator
type(DC_SCALED_SEC):: month, day
continue
month = int( diff % mon / denominator )
result % mon = int(month)
day = int( diff % day / denominator ) + int(CYCLIC_MDAYS * (month - result % mon))
result % day = int(day)
result % sec = diff % sec / denominator + (day - result % day) * diff % day_seconds
result % day_seconds = diff % day_seconds
result % nondim_flag = diff % nondim_flag
call dcdate_normalize(result % day, result % sec, result % day_seconds, result % nondim_flag)
end function dcdate_div_fd
| Function : | |
| result : | type(DC_DIFFTIME) |
| diff : | type(DC_DIFFTIME), intent(in) |
| denominator : | real, intent(in) |
※ 注意 : 月差を除算すると近似的結果になるおそれがあります
type(DC_DIFFTIME) function dcdate_div_fr(diff, denominator) result(result)
!
! ※ 注意 : 月差を除算すると近似的結果になるおそれがあります
implicit none
type(DC_DIFFTIME), intent(in):: diff
real, intent(in):: denominator
continue
result = dcdate_div_fd(diff, real(denominator, DP))
end function dcdate_div_fr
| Function : | |
| result : | real(DP) |
| diff1 : | type(DC_DIFFTIME), intent(in) |
| diff2 : | type(DC_DIFFTIME), intent(in) |
※ 注意 : 月差と日時の混在する除算は近似的結果になるおそれがあります
real(DP) function dcdate_div_ff(diff1, diff2) result(result)
!
! ※ 注意 : 月差と日時の混在する除算は近似的結果になるおそれがあります
use dc_date_types, only: CYCLIC_MDAYS
use dc_scaledsec, only: DC_SCALED_SEC, assignment(=), operator(<), operator(>), operator(<=), operator(>=), operator(+), operator(-), operator(*), operator(/), modulo, int, abs, sign
implicit none
type(DC_DIFFTIME), intent(in):: diff1, diff2
continue
! ゼロ割対応コードが必要か?
result = (diff1 % day_seconds * (CYCLIC_MDAYS * diff1 % mon + diff1 % day) + diff1 % sec) / (diff2 % day_seconds * (CYCLIC_MDAYS * diff2 % mon + diff2 % day) + diff2 % sec)
end function dcdate_div_ff
| Function : | |
| result : | logical |
| time1 : | type(DC_DATETIME), intent(in) |
| time2 : | type(DC_DATETIME), intent(in) |
2 つの引数の日時を比較します. 2 つ目の引数に格納される日時が 1 つ目の引数に格納される日時 よりも進んでいる場合, .true. が返ります.
logical function dcdate_lt_tt(time1, time2) result(result)
!
! 2 つの引数の日時を比較します.
! 2 つ目の引数に格納される日時が 1 つ目の引数に格納される日時
! よりも進んでいる場合, .true. が返ります.
!
use dc_scaledsec, only: DC_SCALED_SEC, operator(==), operator(<), operator(>), operator(<=), operator(>=), operator(+)
implicit none
type(DC_DATETIME), intent(in):: time1, time2
type(DC_SCALED_SEC):: year1, year2, time1_sec, time2_sec
continue
call Eval(time1, sclyear=year1)
call Eval(time2, sclyear=year2)
if (year1 < year2) then
result = .true.
elseif (year1 > year2) then
result = .false.
else
time1_sec = EvalSclSec(time1) + EvalSclSec(ZoneToDiff(time1 % zone))
time2_sec = EvalSclSec(time2) + EvalSclSec(ZoneToDiff(time2 % zone))
if (time1_sec < time2_sec) then
result = .true.
else
result = .false.
end if
end if
end function dcdate_lt_tt
| Function : | |
| result : | logical |
| diff1 : | type(DC_DIFFTIME), intent(in) |
| diff2 : | type(DC_DIFFTIME), intent(in) |
2 つの引数の日時差を比較します. 2 つ目の引数に格納される日時差が 1 つ目の引数に格納される日時差 よりも大きい場合, .true. が返ります.
logical function dcdate_lt_ff(diff1, diff2) result(result)
!
! 2 つの引数の日時差を比較します.
! 2 つ目の引数に格納される日時差が 1 つ目の引数に格納される日時差
! よりも大きい場合, .true. が返ります.
!
use dc_scaledsec, only: operator(<), operator(>), operator(<=), operator(>=), operator(==)
implicit none
type(DC_DIFFTIME), intent(in):: diff1, diff2
continue
if ( diff1 % day_seconds == diff2 % day_seconds ) then
if ( diff1 % mon < diff2 % mon ) then
result = .true.
return
elseif ( diff1 % mon > diff2 % mon ) then
result = .false.
return
end if
if ( diff1 % day < diff2 % day ) then
result = .true.
return
elseif ( diff1 % day > diff2 % day ) then
result = .false.
return
end if
if ( diff1 % sec < diff2 % sec ) then
result = .true.
return
elseif ( diff1 % sec > diff2 % sec ) then
result = .false.
return
end if
result = .false.
else
if (EvalSec(diff1) < EvalSec(diff2)) then
result = .true.
else
result = .false.
end if
end if
end function dcdate_lt_ff
| Function : | |
| result : | logical |
| diff : | type(DC_DIFFTIME), intent(in) |
| factor : | integer, intent(in) |
2 つの引数の日時差を比較します. 2 つ目の引数に格納される日時差が 1 つ目の引数に格納される日時差 よりも大きい場合, .true. が返ります.
logical function dcdate_lt_fi(diff, factor) result(result)
!
! 2 つの引数の日時差を比較します.
! 2 つ目の引数に格納される日時差が 1 つ目の引数に格納される日時差
! よりも大きい場合, .true. が返ります.
!
implicit none
type(DC_DIFFTIME), intent(in):: diff
integer, intent(in):: factor
continue
result = EvalSec(diff) < factor
end function dcdate_lt_fi
| Function : | |
| result : | logical |
| factor : | integer, intent(in) |
| diff : | type(DC_DIFFTIME), intent(in) |
2 つの引数の日時差を比較します. 2 つ目の引数に格納される日時差が 1 つ目の引数に格納される日時差 よりも大きい場合, .true. が返ります.
logical function dcdate_lt_if(factor, diff) result(result)
!
! 2 つの引数の日時差を比較します.
! 2 つ目の引数に格納される日時差が 1 つ目の引数に格納される日時差
! よりも大きい場合, .true. が返ります.
!
implicit none
integer, intent(in):: factor
type(DC_DIFFTIME), intent(in):: diff
continue
result = factor < EvalSec(diff)
end function dcdate_lt_if
| Function : | |
| result : | logical |
| time1 : | type(DC_DATETIME), intent(in) |
| time2 : | type(DC_DATETIME), intent(in) |
2 つの引数の日時を比較します. 2 つ目の引数に格納される日時が 1 つ目の引数に格納される日時 よりも進んでいる場合かもしくは等しい場合, .true. が返ります.
logical function dcdate_le_tt(time1, time2) result(result)
!
! 2 つの引数の日時を比較します.
! 2 つ目の引数に格納される日時が 1 つ目の引数に格納される日時
! よりも進んでいる場合かもしくは等しい場合, .true. が返ります.
!
implicit none
type(DC_DATETIME), intent(in):: time1, time2
continue
result = .not. time1 > time2
end function dcdate_le_tt
| Function : | |
| result : | logical |
| diff1 : | type(DC_DIFFTIME), intent(in) |
| diff2 : | type(DC_DIFFTIME), intent(in) |
2 つの引数の日時差を比較します. 2 つ目の引数に格納される日時差が 1 つ目の引数に格納される日時差 よりも大きい場合かもしくは等しい場合, .true. が返ります.
logical function dcdate_le_ff(diff1, diff2) result(result)
!
! 2 つの引数の日時差を比較します.
! 2 つ目の引数に格納される日時差が 1 つ目の引数に格納される日時差
! よりも大きい場合かもしくは等しい場合, .true. が返ります.
!
implicit none
type(DC_DIFFTIME), intent(in):: diff1, diff2
continue
result = .not. diff1 > diff2
end function dcdate_le_ff
| Function : | |
| result : | logical |
| diff : | type(DC_DIFFTIME), intent(in) |
| factor : | integer, intent(in) |
2 つの引数の日時差を比較します. 2 つ目の引数に格納される日時差が 1 つ目の引数に格納される日時差 よりも大きい場合かもしくは等しい場合, .true. が返ります.
logical function dcdate_le_fi(diff, factor) result(result)
!
! 2 つの引数の日時差を比較します.
! 2 つ目の引数に格納される日時差が 1 つ目の引数に格納される日時差
! よりも大きい場合かもしくは等しい場合, .true. が返ります.
!
implicit none
type(DC_DIFFTIME), intent(in):: diff
integer, intent(in):: factor
continue
result = .not. diff > factor
end function dcdate_le_fi
| Function : | |
| result : | logical |
| factor : | integer, intent(in) |
| diff : | type(DC_DIFFTIME), intent(in) |
2 つの引数の日時差を比較します. 2 つ目の引数に格納される日時差が 1 つ目の引数に格納される日時差 よりも大きい場合かもしくは等しい場合, .true. が返ります.
logical function dcdate_le_if(factor, diff) result(result)
!
! 2 つの引数の日時差を比較します.
! 2 つ目の引数に格納される日時差が 1 つ目の引数に格納される日時差
! よりも大きい場合かもしくは等しい場合, .true. が返ります.
!
implicit none
integer, intent(in):: factor
type(DC_DIFFTIME), intent(in):: diff
continue
result = .not. factor > diff
end function dcdate_le_if
| Function : | |
| result : | logical |
| time1 : | type(DC_DATETIME), intent(in) |
| time2 : | type(DC_DATETIME), intent(in) |
2 つの引数の日時を比較します. 1 つ目の引数に格納される日時が 2 つ目の引数に格納される日時 と同じ場合, .true. が返ります.
logical function dcdate_eq_tt(time1, time2) result(result)
!
! 2 つの引数の日時を比較します.
! 1 つ目の引数に格納される日時が 2 つ目の引数に格納される日時
! と同じ場合, .true. が返ります.
!
use dc_scaledsec, only: DC_SCALED_SEC, operator(==), operator(<), operator(>), operator(<=), operator(>=), operator(+), assignment(=)
implicit none
type(DC_DATETIME), intent(in):: time1, time2
type(DC_SCALED_SEC):: year1, year2, time1_sec, time2_sec
continue
call Eval(time1, sclyear=year1)
call Eval(time2, sclyear=year2)
time1_sec = EvalSclSec(time1) + EvalSclSec(ZoneToDiff(time1 % zone))
time2_sec = EvalSclSec(time2) + EvalSclSec(ZoneToDiff(time2 % zone))
if (year1 == year2 .and. time1_sec == time2_sec) then
result = .true.
else
result = .false.
end if
end function dcdate_eq_tt
| Function : | |
| result : | logical |
| diff1 : | type(DC_DIFFTIME), intent(in) |
| diff2 : | type(DC_DIFFTIME), intent(in) |
2 つの引数の日時差を比較します. 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差 と同じ場合, .true. が返ります.
logical function dcdate_eq_ff(diff1, diff2) result(result)
!
! 2 つの引数の日時差を比較します.
! 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差
! と同じ場合, .true. が返ります.
!
use dc_scaledsec, only: operator(==)
implicit none
type(DC_DIFFTIME), intent(in):: diff1, diff2
continue
if ( diff1 % mon == diff2 % mon .and. diff1 % day == diff2 % day .and. diff1 % sec == diff2 % sec ) then
result = .true.
else
result = .false.
end if
end function dcdate_eq_ff
| Function : | |
| result : | logical |
| i : | integer, intent(in) |
| diff : | type(DC_DIFFTIME), intent(in) |
引数 diff の日時差が i と等しいかどうかを比較します. diff を秒数に換算した値と i とが等しい場合, .true. が返ります.
logical function dcdate_eq_if(i, diff) result(result)
!
! 引数 *diff* の日時差が *i* と等しいかどうかを比較します. *diff*
! を秒数に換算した値と *i* とが等しい場合, .true. が返ります.
!
implicit none
type(DC_DIFFTIME), intent(in):: diff
integer, intent(in):: i
continue
result = dcdate_eq_rf(real(i), diff)
end function dcdate_eq_if
| Function : | |
| result : | logical |
| diff : | type(DC_DIFFTIME), intent(in) |
| i : | integer, intent(in) |
logical function dcdate_eq_fi(diff, i) result(result)
implicit none
type(DC_DIFFTIME), intent(in):: diff
integer, intent(in):: i
continue
result = dcdate_eq_if(i, diff)
end function dcdate_eq_fi
| Function : | |
| result : | logical |
| r : | real, intent(in) |
| diff : | type(DC_DIFFTIME), intent(in) |
引数 diff の日時差が r と等しいかどうかを比較します. diff を秒数に換算した値と r とが等しい場合, .true. が返ります.
logical function dcdate_eq_rf(r, diff) result(result)
!
! 引数 *diff* の日時差が *r* と等しいかどうかを比較します. *diff*
! を秒数に換算した値と *r* とが等しい場合, .true. が返ります.
!
use dc_scaledsec, only: operator(==)
implicit none
type(DC_DIFFTIME), intent(in):: diff
real, intent(in):: r
continue
if (EvalSclSec(diff) == r) then
result = .true.
else
result = .false.
end if
end function dcdate_eq_rf
| Function : | |
| result : | logical |
| diff : | type(DC_DIFFTIME), intent(in) |
| r : | real, intent(in) |
logical function dcdate_eq_fr(diff, r) result(result)
implicit none
type(DC_DIFFTIME), intent(in):: diff
real, intent(in):: r
continue
result = dcdate_eq_rf(r, diff)
end function dcdate_eq_fr
| Function : | |
| result : | logical |
| d : | real(DP), intent(in) |
| diff : | type(DC_DIFFTIME), intent(in) |
引数 diff の日時差が d と等しいかどうかを比較します. diff を秒数に換算した値と d とが等しい場合, .true. が返ります.
logical function dcdate_eq_df(d, diff) result(result)
!
! 引数 *diff* の日時差が *d* と等しいかどうかを比較します. *diff*
! を秒数に換算した値と *d* とが等しい場合, .true. が返ります.
!
use dc_types, only: DP
use dc_scaledsec, only: operator(==)
implicit none
type(DC_DIFFTIME), intent(in):: diff
real(DP), intent(in):: d
continue
if (EvalSclSec(diff) == d) then
result = .true.
else
result = .false.
end if
end function dcdate_eq_df
| Function : | |
| result : | logical |
| diff : | type(DC_DIFFTIME), intent(in) |
| d : | real(DP), intent(in) |
logical function dcdate_eq_fd(diff, d) result(result)
use dc_types, only: DP
implicit none
type(DC_DIFFTIME), intent(in):: diff
real(DP), intent(in):: d
continue
result = dcdate_eq_df(d, diff)
end function dcdate_eq_fd
| Function : | |
| result : | logical |
| time1 : | type(DC_DATETIME), intent(in) |
| time2 : | type(DC_DATETIME), intent(in) |
2 つの引数の日時を比較します. 1 つ目の引数に格納される日時が 2 つ目の引数に格納される日時 よりも進んでいる場合, .true. が返ります.
logical function dcdate_gt_tt(time1, time2) result(result)
!
! 2 つの引数の日時を比較します.
! 1 つ目の引数に格納される日時が 2 つ目の引数に格納される日時
! よりも進んでいる場合, .true. が返ります.
!
use dc_scaledsec, only: DC_SCALED_SEC, operator(==), operator(<), operator(>), operator(<=), operator(>=), operator(+), operator(-), operator(*), operator(/), mod, modulo, int, abs, sign
implicit none
type(DC_DATETIME), intent(in):: time1, time2
type(DC_SCALED_SEC):: year1, year2, time1_sec, time2_sec
continue
call Eval(time1, sclyear=year1)
call Eval(time2, sclyear=year2)
if (year1 > year2) then
result = .true.
elseif (year1 < year2) then
result = .false.
else
time1_sec = EvalSclSec(time1) + EvalSclSec(ZoneToDiff(time1 % zone))
time2_sec = EvalSclSec(time2) + EvalSclSec(ZoneToDiff(time2 % zone))
if (time1_sec > time2_sec) then
result = .true.
else
result = .false.
end if
end if
end function dcdate_gt_tt
| Function : | |
| result : | logical |
| diff1 : | type(DC_DIFFTIME), intent(in) |
| diff2 : | type(DC_DIFFTIME), intent(in) |
2 つの引数の日時差を比較します. 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差 よりも大きい場合, .true. が返ります.
logical function dcdate_gt_ff(diff1, diff2) result(result)
!
! 2 つの引数の日時差を比較します.
! 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差
! よりも大きい場合, .true. が返ります.
!
use dc_date_types, only: CYCLIC_MDAYS
use dc_scaledsec, only: operator(<), operator(>), operator(<=), operator(>=), operator(==)
implicit none
type(DC_DIFFTIME), intent(in):: diff1, diff2
continue
if ( diff1 % day_seconds == diff2 % day_seconds ) then
if ( diff1 % mon > diff2 % mon ) then
result = .true.
return
elseif ( diff1 % mon < diff2 % mon ) then
result = .false.
return
end if
if ( diff1 % day > diff2 % day ) then
result = .true.
return
elseif ( diff1 % day < diff2 % day ) then
result = .false.
return
end if
if ( diff1 % sec > diff2 % sec ) then
result = .true.
return
elseif ( diff1 % sec < diff2 % sec ) then
result = .false.
return
end if
result = .false.
else
if (EvalSec(diff1) > EvalSec(diff2)) then
result = .true.
else
result = .false.
end if
end if
end function dcdate_gt_ff
| Function : | |
| result : | logical |
| diff : | type(DC_DIFFTIME), intent(in) |
| factor : | integer, intent(in) |
2 つの引数の日時差を比較します. 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差 よりも大きい場合, .true. が返ります.
logical function dcdate_gt_fi(diff, factor) result(result)
!
! 2 つの引数の日時差を比較します.
! 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差
! よりも大きい場合, .true. が返ります.
!
use dc_date_types, only: CYCLIC_MDAYS
implicit none
type(DC_DIFFTIME), intent(in):: diff
integer, intent(in):: factor
continue
result = EvalSec(diff) > factor
end function dcdate_gt_fi
| Function : | |
| result : | logical |
| factor : | integer, intent(in) |
| diff : | type(DC_DIFFTIME), intent(in) |
2 つの引数の日時差を比較します. 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差 よりも大きい場合, .true. が返ります.
logical function dcdate_gt_if(factor, diff) result(result)
!
! 2 つの引数の日時差を比較します.
! 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差
! よりも大きい場合, .true. が返ります.
!
use dc_date_types, only: CYCLIC_MDAYS
implicit none
integer, intent(in):: factor
type(DC_DIFFTIME), intent(in):: diff
continue
result = factor > EvalSec(diff)
end function dcdate_gt_if
| Function : | |
| result : | logical |
| time1 : | type(DC_DATETIME), intent(in) |
| time2 : | type(DC_DATETIME), intent(in) |
2 つの引数の日時を比較します. 1 つ目の引数に格納される日時が 2 つ目の引数に格納される日時 よりも進んでいる場合かもしくは等しい場合, .true. が返ります.
logical function dcdate_ge_tt(time1, time2) result(result)
!
! 2 つの引数の日時を比較します.
! 1 つ目の引数に格納される日時が 2 つ目の引数に格納される日時
! よりも進んでいる場合かもしくは等しい場合, .true. が返ります.
!
implicit none
type(DC_DATETIME), intent(in):: time1, time2
continue
result = .not. time1 < time2
end function dcdate_ge_tt
| Function : | |
| result : | logical |
| diff1 : | type(DC_DIFFTIME), intent(in) |
| diff2 : | type(DC_DIFFTIME), intent(in) |
2 つの引数の日時差を比較します. 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差 よりも大きい場合かもしくは等しい場合, .true. が返ります.
logical function dcdate_ge_ff(diff1, diff2) result(result)
!
! 2 つの引数の日時差を比較します.
! 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差
! よりも大きい場合かもしくは等しい場合, .true. が返ります.
!
implicit none
type(DC_DIFFTIME), intent(in):: diff1, diff2
continue
result = .not. diff1 < diff2
end function dcdate_ge_ff
| Function : | |
| result : | logical |
| diff : | type(DC_DIFFTIME), intent(in) |
| factor : | integer, intent(in) |
2 つの引数の日時差を比較します. 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差 よりも大きい場合かもしくは等しい場合, .true. が返ります.
logical function dcdate_ge_fi(diff, factor) result(result)
!
! 2 つの引数の日時差を比較します.
! 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差
! よりも大きい場合かもしくは等しい場合, .true. が返ります.
!
implicit none
type(DC_DIFFTIME), intent(in):: diff
integer, intent(in):: factor
continue
result = .not. diff < factor
end function dcdate_ge_fi
| Function : | |
| result : | logical |
| factor : | integer, intent(in) |
| diff : | type(DC_DIFFTIME), intent(in) |
2 つの引数の日時差を比較します. 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差 よりも大きい場合かもしくは等しい場合, .true. が返ります.
logical function dcdate_ge_if(factor, diff) result(result)
!
! 2 つの引数の日時差を比較します.
! 1 つ目の引数に格納される日時差が 2 つ目の引数に格納される日時差
! よりも大きい場合かもしくは等しい場合, .true. が返ります.
!
implicit none
integer, intent(in):: factor
type(DC_DIFFTIME), intent(in):: diff
continue
result = .not. factor < diff
end function dcdate_ge_if
| Function : | |
| result : | character(STRING) |
| time : | type(DC_DATETIME), intent(in) |
dc_date_types#DC_DATETIME 型変数を文字型変数へ変換して返します. 書式は下記のように JIS X 0301 の完全表記です.
YYYY-MM-DDThh:mm:ss.sTZD
YYYY は年, MM は月, DD は日, hh は時, mm は分, ss.s は秒, TZD はタイムゾーンを表します.
Original external subprogram is dcdatetimetochar.f90#DCDateTimeToChar
| Function : | |
| result : | character(STRING) |
| diff : | type(DC_DIFFTIME), intent(in) |
dc_date_types#DC_DIFFTIME 型変数を文字型変数へ変換して返します. 書式は以下のようになります.
YYYY-MM-DDThh:mm:ss.s
YYYY は年, MM は月, DD は日, hh は時, mm は分, ss.s は秒を表します. ただし, DD は 2 桁を超える場合があります. (dc_date_types#DC_DIFFTIME は X ヶ月後, X 日前, などを表現するため のデータ型なので, 日を月に繰り上げたり, 月を日に繰り下げることを しません. また「年」の情報も持ちません. 1 年の日数や 1 月の日数は dc_date_types#DC_DATETIME 側で決まります).
なお, DCDiffTimeCreate において, 単位を ‘1’ とした場合は無時限時間と 扱うため, 以下のような書式となります.
ss.s
Original external subprogram is dcdatetimetochar.f90#DCDiffTimeToChar
| Function : | |
| result : | character(TOKEN) |
| time : | type(DC_DATETIME), intent(in) |
| upcase : | logical, intent(in), optional |
dc_date_types#DC_DATETIME 型変数の暦を文字型にして返します. 現在サポートされている暦は以下の通りです. 左が暦を示す整数型変数, 右が返る文字列です. upcase に .true. を与えた場合には, 大文字となって返ります.
dc_date_types#CAL_CYCLIC : cyclic dc_date_types#CAL_NOLEAP : noleap dc_date_types#CAL_JULIAN : julian dc_date_types#CAL_GREGORIAN : gregorian
Original external subprogram is dcdatetimetochar.f90#DCDateTimeToCharCal