135 & year, mon, day, hour, min, sec, &
136 & zone, zone_hour, zone_min, caltype, caltype_str, day_seconds, &
137 & sclyear, sclmon, sclday, sclsec, err)
143 & caltype_default =>
caltype, &
154 &
operator(==),
operator(>),
operator(<),
operator(>=),
operator(<=), &
155 &
operator(+),
operator(-),
operator(*),
operator(/),
mod,
modulo, &
160 integer,
intent(in),
optional:: year
161 integer,
intent(in),
optional:: mon
162 integer,
intent(in),
optional:: day
163 integer,
intent(in),
optional:: hour
164 integer,
intent(in),
optional:: min
165 real(DP),
intent(in),
optional:: sec
166 character(*),
intent(in),
optional :: zone
167 integer,
intent(in),
optional :: zone_hour
168 integer,
intent(in),
optional :: zone_min
169 integer,
intent(in),
optional:: caltype
170 character(*),
intent(in),
optional:: caltype_str
171 real(DP),
intent(in),
optional:: day_seconds
176 logical,
intent(out),
optional:: err
179 integer :: gcday, gcmon, gcyear
180 real(DP):: essec, esds
182 type(
dc_scaled_sec):: iday, imon, month, iyear, century, isec
183 character(6) :: izone
184 integer,
parameter:: year_default = 0, mon_default = 1
185 integer,
parameter:: day_default = 1
186 integer,
parameter:: sec_default = 0
187 logical :: current_time_used
189 character(STRING):: zone_str_long
190 integer :: stat, cause_i
191 character(STRING) :: cause_c
192 character(*),
parameter :: subname =
'DCDateTimeCreate1'
194 current_time_used = .not.
present(year) &
195 & .and. .not.
present(mon) &
196 & .and. .not.
present(day) &
197 & .and. .not.
present(hour) &
198 & .and. .not.
present(
min) &
199 & .and. .not.
present(sec) &
200 & .and. .not.
present(sclyear) &
201 & .and. .not.
present(sclmon) &
202 & .and. .not.
present(sclday) &
203 & .and. .not.
present(sclsec)
204 call beginsub(subname,
'current_time_used=<%y>', l=(/current_time_used/))
209 if (
present(day_seconds) )
then
210 time % day_seconds = day_seconds
222 if (.not. current_time_used)
then
223 if (
present(zone_hour) .or.
present(zone_min) )
then
225 & hour = zone_hour,
min = zone_min )
226 zone_str_long =
tochar(zonediff)
227 if ( zone_str_long(1:1) ==
'-' )
then
232 izone(2:6) = zone_str_long(13:17)
234 if (
present(zone))
then
240 if (
present(err))
then
242 &
'zone=<%c> is invalid.', &
249 if (
present(sclsec) )
then
251 elseif(
present(sec) )
then
256 if (
present(
min))
then
259 if (
present(hour))
then
263 if (
present(sclday) )
then
265 elseif(
present(day) )
then
271 if (
present(sclday) )
then
273 elseif(
present(day) )
then
278 iday = iday +
floor(isec / time % day_seconds)
280 if (
present(sclmon) )
then
282 elseif(
present(mon) )
then
288 if (
present(sclyear) )
then
290 elseif(
present(year) )
then
298 time % sec =
modulo(isec, time % day_seconds)
299 time % caltype = caltype_default
300 if (
present(caltype_str))
then
301 select case(
lchar(trim(caltype_str)) )
316 &
'caltype=<%c> is invalid calender type.', &
317 & c1 = trim(caltype_str) )
318 if ( .not.
present(err) )
then
324 if (
present(caltype))
then
326 time % caltype = caltype
330 if (
present(err))
then
332 &
'caltype=<%d> is invalid calender type.', &
345 iday = iday +
int( (month * 306 - 914) / 10 )
347 time % day = iday + iyear * 365 + 90
351 time % day = iday + 91
352 elseif (iday < 640116)
then
353 time % day = iday + 91
355 century = (iyear -
modulo(iyear, 100)) / 100 + 1
356 time % day = iday -
int( (century * 3 -
modulo(century * 3, 4)) / 4 ) + 93
362 call storeerror(stat, subname, err, cause_c, cause_i)
363 esday = time % day ; essec = time % sec ; esds = time % day_seconds
364 call endsub(subname,
'time (caltype=%d, day=%d, sec=%f, zone=%c, day_seconds=%f)', &
365 & i=(/time % caltype, esday/), d=(/essec, esds/), &
366 & c1=trim(time % zone))
395 integer,
intent(out) :: jyear, jmon, jday
396 real(DP),
intent(out) :: jsec
397 character(*),
intent(out) :: jzone
399 integer :: date_time_values(1:8)
400 character(5) :: zone_raw
403 call date_and_time(zone=zone_raw, values=date_time_values)
405 jzone = zone_raw(1:3) //
":" // zone_raw(4:5)
407 jyear = date_time_values(1)
408 jmon = date_time_values(2)
409 jday = date_time_values(3)
412 & + real(date_time_values(7), dp)
471 & year, mon, day, hour, min, sec, day_seconds, nondim, &
472 & sclyear, sclmon, sclday, sclsec )
483 &
operator(==),
operator(>),
operator(<),
operator(>=),
operator(<=), &
484 &
operator(+),
operator(-),
operator(*),
operator(/),
mod,
modulo, &
490 integer,
intent(in),
optional:: year
491 integer,
intent(in),
optional:: mon
492 integer,
intent(in),
optional:: day
493 integer,
intent(in),
optional:: hour
494 integer,
intent(in),
optional:: min
495 real(DP),
intent(in),
optional:: sec
496 real(DP),
intent(in),
optional:: day_seconds
497 real(DP),
intent(in),
optional:: nondim
504 integer,
parameter:: year_default = 0, mon_default = 0
505 integer,
parameter:: day_default = 0, hour_default = 0, min_default = 0
506 integer,
parameter:: sec_default = 0
507 real(DP):: essec, esds
508 integer :: esmon, esday
509 character(STRING):: endsub_msb
511 character(*),
parameter :: subname =
'DCDiffTimeCreate1'
515 if (
present(nondim) )
then
516 diff % nondim_flag = .true.
522 diff % nondim_flag = .false.
525 if (
present(sclyear) )
then
527 elseif(
present(year) )
then
533 if (
present(sclmon) )
then
535 elseif(
present(mon) )
then
541 if (
present(sclday) )
then
543 elseif(
present(day) )
then
552 if (
present(sclsec) )
then
554 elseif(
present(sec) )
then
566 if(
present(day_seconds) )
then
567 diff % day_seconds = day_seconds
569 diff % day_seconds = day_seconds_default
572 call dcdate_normalize(diff % day, diff % sec, diff % day_seconds, diff % nondim_flag)
575 call debug( dbg_mode )
577 esmon = diff % mon ; esday = diff % day
578 essec = diff % sec ; esds = diff % day_seconds
580 &
cprintf(
'mon=%d, day=%d, sec=%f, day_seconds=%f, nondim_flag=%b', &
581 & i = (/ esmon, esday /), d = (/ essec, esds /), &
582 & l = (/ diff % nondim_flag /) )
586 call endsub(subname,
'diff (%c)', c1 = trim(endsub_msb) )
692 &
operator(==),
operator(>),
operator(<),
operator(>=),
operator(<=), &
693 &
operator(+),
operator(-),
operator(*),
operator(/),
mod,
modulo, &
697 real(DP),
intent(in) :: value
698 character(*),
intent(in) :: unit
699 integer,
intent(in),
optional :: unit_symbol
700 logical,
intent(out),
optional :: err
703 integer :: esmon, esday
704 integer :: stat, val_int
706 character(STRING) :: cause_c
709 character(*),
parameter :: subname =
'DCDiffTimeCreate2'
711 call beginsub(subname,
'value=%f', d=(/
value/))
715 if (
present(unit_symbol) )
then
731 val_dec =
value -
int(
value)
752 esmon = diff % mon ; esday = diff % day ; essec = diff % sec
753 call endsub(subname,
'diff (mon=%d, day=%d, sec=%f)', &
754 & i=(/esmon, esday/), d=(/essec/))
780 real,
intent(in) :: value
781 character(*),
intent(in) :: unit
782 integer,
intent(in),
optional :: unit_symbol
783 logical,
intent(out),
optional :: err
811 integer,
intent(in) :: value
812 character(*),
intent(in) :: unit
813 integer,
intent(in),
optional :: unit_symbol
814 logical,
intent(out),
optional :: err
847 integer,
intent(in):: sec
880 real,
intent(in):: sec
903 real(DP),
intent(in):: sec
936 integer,
intent(in):: sec
969 real,
intent(in):: sec
992 real(DP),
intent(in):: sec
1007 & year, mon, day, hour, min, sec, &
1008 & zone, caltype, day_seconds, err)
1013 integer,
intent(in),
optional:: year, mon, day, hour, min
1014 real(DP),
intent(in),
optional:: sec, day_seconds
1015 character(*),
intent(in),
optional :: zone
1016 integer,
intent(in),
optional:: caltype
1017 logical,
intent(out),
optional:: err
1020 & year, mon, day, hour,
min, sec, &
1021 & zone, caltype, day_seconds = day_seconds, err = err )
1031 & year, mon, day, hour, min, sec, day_seconds)
1036 integer,
intent(in),
optional:: year, mon, day, hour, min
1037 real(DP),
intent(in),
optional:: sec, day_seconds
1040 & year, mon, day, hour,
min, sec, day_seconds )
1054 real(DP),
intent(in) :: value
1055 character(*),
intent(in) :: unit
1056 logical,
intent(out),
optional :: err
subroutine dcdatetimecreater(time, sec)
subroutine dcdatetimecreate1_bc(time, year, mon, day, hour, min, sec, zone, caltype, day_seconds, err)
subroutine dcdifftimecreated(diff, sec)
subroutine dcdifftimecreate2r(diff, value, unit, unit_symbol, err)
subroutine dcdifftimecreatei(diff, sec)
subroutine dcdifftimecreate2d(diff, value, unit, unit_symbol, err)
subroutine dcdifftimecreater(diff, sec)
subroutine dcdifftimecreate1_bc(diff, year, mon, day, hour, min, sec, day_seconds)
subroutine dcdatetimecreatei(time, sec)
subroutine dcdatetimecreate1(time, year, mon, day, hour, min, sec, zone, zone_hour, zone_min, caltype, caltype_str, day_seconds, sclyear, sclmon, sclday, sclsec, err)
dc_date_types::DC_DATETIME, dc_date_types::DC_DIFFTIME 型変数の生成
subroutine dcdatetimecreated(time, sec)
subroutine dcdifftimecreate2i(diff, value, unit, unit_symbol, err)
subroutine dcdifftimecreate2_bc(diff, value, unit, err)
subroutine get_current_time(jyear, jmon, jday, jsec, jzone)
subroutine dcdifftimecreate1(diff, year, mon, day, hour, min, sec, day_seconds, nondim, sclyear, sclmon, sclday, sclsec)
subroutine, public dcdate_set_day_seconds_scl
subroutine, public dcdate_normalize(day, sec, day_seconds, nondim_flag)
integer, parameter, public unit_symbol_err
無効な単位を示すシンボル
integer, parameter, public unit_symbol_hour
時間の単位を示すシンボル
integer, parameter, public unit_symbol_min
分の単位を示すシンボル
integer, parameter, public cal_noleap
閏年無しの暦 (1年 365 日)
real(dp), parameter, public cyclic_mdays
周期暦での1ヶ月の日数 (DC_DIFFTIME の月換算にも使用)
integer, parameter, public hour_seconds
1時間の秒数
integer, parameter, public unit_symbol_month
月の単位を示すシンボル
integer, parameter, public four_years
4年の日数 (閏年を含む)
integer, parameter, public cal_cyclic
周期暦 (1ヶ月 30.6 日)
real(dp), save, public day_seconds
1日の秒数 (可変, デフォルトは地球の1日)
integer, save, public caltype
デフォルトの暦タイプ (グレゴリオ暦)
integer, parameter, public unit_symbol_sec
秒の単位を示すシンボル
integer, parameter, public unit_symbol_nondim
無次元時間の単位を示すシンボル
type(dc_scaled_sec), save, public day_seconds_scl
1日の秒数 (DC_SCALED_SEC 型)
logical, save, public flag_set_day_seconds_scl
day_seconds_scl が設定済みかどうかのフラグ
integer, parameter, public year_months
1年の月数
integer, parameter, public cal_gregorian
グレゴリオ暦
integer, parameter, public min_seconds
1分の秒数
integer, parameter, public unit_symbol_day
日の単位を示すシンボル
integer, parameter, public unit_symbol_year
年の単位を示すシンボル
integer, parameter, public cal_julian
ユリウス暦
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_ebadunit
integer, parameter, public dc_noerr
エラー等を保持
integer, parameter, public dc_ebadcaltype
integer, parameter, public dc_ebadtimezone
subroutine, public dcscaledsecputline(sclsec, unit, indent)
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
integer, parameter, public dp
倍精度実数型変数