gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
dccaldatecurrent.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine dccaldatecurrent1 (date, err)
 Get current date and time.

Function/Subroutine Documentation

◆ dccaldatecurrent1()

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

Get current date and time.

Author
Yasuhiro MORIKAWA

Procedures described in this file are provided from "dc_calendar" module.

Get current actual time

Return actual time date (type "dc_calendar_types#DC_CAL_DATE"). The actual time is acquired by "date_and_time" that is a built-in subroutine of Fortran 90 or more.

Parameters
[out]dateAn object that stores information of date and time of actual time.
[out]errException handling flag. By default, when error occur in this procedure, the program aborts. If this err argument is given, .true. is substituted to err and the program does not abort.

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 )
Interface declarations for dc_calendar procedures.
Derived types and parameters of calendar and date.
Error handling module.
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
Error storage variables
Definition dc_error.f90:468
integer, parameter, public dc_ebaddate
Definition dc_error.f90:552
Message output module.
Debug tracing module.
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
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public token
Character length for word, token
Definition dc_types.f90:128
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
integer, parameter, public dp
Double Precision Real number
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: