gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
dccaldatecurrent.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine dccaldatecurrent1 (date, err)
 現在日時の取得

Function/Subroutine Documentation

◆ dccaldatecurrent1()

subroutine dccaldatecurrent1 ( type(dc_cal_date), intent(out) date,
logical, intent(out), optional err )

現在日時の取得

Author
Yasuhiro MORIKAWA

このファイルに記載される手続き群は dc_calendar モジュールから提供されます.

実時間の現在日時を取得

実時間を dc_calendar_types#DC_CAL_DATE 型の date に返します. 実時間は Fortran 90 以降の組み込みサブルーチンである date_and_time から得られます.

Parameters
[out]date実時間の日時情報を収めたオブジェクト.
[out]err例外処理用フラグ. デフォルトでは, この手続き内でエラーが生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Definition at line 51 of file dccaldatecurrent.f90.

54 use dc_message, only: messagenotify
55 use dc_types, only: dp, token
56 use dc_trace, only: beginsub, endsub
58 use dc_types, only: string
59 implicit none
60 type(DC_CAL_DATE), intent(out):: date
61 logical, intent(out), optional:: err
62
63 ! 作業変数
64 ! Work variables
65 !
66 integer :: date_time_values(1:8)
67 character(5) :: zone_raw
68
69 character(TOKEN):: zone
70 integer:: stat
71 character(STRING):: cause_c
72 character(*), parameter:: subname = 'DCCalDateCurrent1'
73continue
74 call beginsub( subname )
75 stat = dc_noerr
76 cause_c = ''
77
78!!$ ! 初期設定のチェック
79!!$ ! Check initialization
80!!$ !
81!!$ if ( datep % initialized ) then
82!!$ stat = DC_EALREADYINIT
83!!$ cause_c = 'DC_CAL_DATE'
84!!$ goto 999
85!!$ end if
86
87
88 ! date_and_time 組み込みサブルーチンを用いて, 現在
89 ! 時刻と UTC からの時差を取得.
90 !
91 call date_and_time(zone=zone_raw, values=date_time_values)
92 zone = zone_raw(1:3) // ":" // zone_raw(4:5)
93
94
95 ! オブジェクトの作成
96 ! Create an object
97 !
98 call dccaldatecreate( &
99 & date_time_values(1), date_time_values(2), date_time_values(3), & ! (in)
100 & date_time_values(5), date_time_values(6), & ! (in)
101 & real( date_time_values(7), dp ), & ! (in)
102 & date, zone, err = err ) ! (out) optional
103 if ( present(err) ) then
104 if ( err ) then
105 stat = dc_ebaddate
106 goto 999
107 end if
108 end if
109
110 ! 終了処理, 例外処理
111 ! Termination and Exception handling
112 !
113999 continue
114 call storeerror( stat, subname, err, cause_c )
115 call endsub( subname )
dc_calendar 手続のインターフェース宣言
暦と日時に関する構造データ型と定数
エラー処理用モジュール
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_noerr
エラー等を保持
Definition dc_error.f90:468
integer, parameter, public dc_ebaddate
Definition dc_error.f90:552
メッセージの出力
デバッグ時の追跡用モジュール
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
Definition dc_types.f90:128
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:137
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:92

References dc_trace::beginsub(), dc_error::dc_ebaddate, dc_error::dc_noerr, dc_types::dp, dc_trace::endsub(), dc_error::storeerror(), dc_types::string, and dc_types::token.

Here is the call graph for this function: