13 & sec, caltype, zone, sclyear, sclmon, sclday, sclsec)
26 &
operator(==),
operator(>),
operator(<),
operator(>=),
operator(<=), &
27 &
operator(+),
operator(-),
operator(*),
operator(/), mod, modulo, &
28 & abs, int, floor, ceiling
29 use dc_trace
, only: beginsub, endsub
31 type(dc_datetime),
intent(in):: time
32 integer,
intent(out),
optional:: year
33 integer,
intent(out),
optional:: mon
34 integer,
intent(out),
optional:: day
35 integer,
intent(out),
optional:: hour
36 integer,
intent(out),
optional:: min
37 real(DP),
intent(out),
optional:: sec
38 integer,
intent(out),
optional:: caltype
39 character(*),
intent(out),
optional:: zone
40 type(dc_scaled_sec),
intent(out),
optional:: sclyear
41 type(dc_scaled_sec),
intent(out),
optional:: sclmon
42 type(dc_scaled_sec),
intent(out),
optional:: sclday
43 type(dc_scaled_sec),
intent(out),
optional:: sclsec
45 type(dc_scaled_sec):: iyear, month, iday, imon, isec
49 if (
present(zone))
then 52 if (
present(caltype))
then 53 caltype = time % caltype
56 if (
present(hour))
then 60 if (
present(min))
then 64 if (
present(sec))
then 67 if (
present(sclsec))
then 73 if (
present(year)) year = 0
74 if (
present(sclyear)) sclyear = 0
75 if (
present(sclmon))
then 78 elseif (
present(mon))
then 82 if (
present(day)) day = iday
83 if (
present(sclday)) sclday = iday
87 iday = int( modulo(time%day - 91,
year_days) )
88 iyear = int( (time%day - 91 - iday) /
year_days )
90 if (time % caltype ==
cal_julian .or. time%day < 640196)
then 91 iday = int( modulo(time%day - 92,
four_years) )
92 iyear = int( (time%day - 92 - iday) /
four_years ) * 4
95 iyear = int( (time%day - 94 - iday) /
four_century ) * 400
100 iyear = iyear + int( iday / 36524 ) * 100
101 iday = int( modulo(iday, 36524) )
115 iday = iday * 10 + 922
116 month = int( iday / 306 )
118 if (
present(sclyear))
then 120 sclyear = iyear + int( (month - imon) /
year_months )
121 elseif (
present(year))
then 127 if (
present(sclmon))
then 128 iday = int( mod(iday, 306) / 10 ) + 1
130 elseif (
present(mon))
then 131 iday = int( mod(iday, 306) / 10 ) + 1
134 iday = int( iday / 10 ) + 1
137 if (
present(day)) day = iday
138 if (
present(sclday)) sclday = iday
146 & year, mon, day, hour, min, sec, nondim, &
147 & sclyear, sclmon, sclday, sclsec, sclnondim, err)
154 use dc_trace
, only: beginsub, endsub
160 &
operator(==),
operator(>),
operator(<),
operator(>=),
operator(<=), &
161 &
operator(+),
operator(-),
operator(*),
operator(/), mod, modulo, &
162 & abs, int, floor, ceiling
164 type(dc_difftime),
intent(in):: diff
165 integer,
intent(out),
optional:: year
166 integer,
intent(out),
optional:: mon
167 integer,
intent(out),
optional:: day
168 integer,
intent(out),
optional:: hour
169 integer,
intent(out),
optional:: min
170 real(DP),
intent(out),
optional:: sec
171 real(DP),
intent(out),
optional:: nondim
172 type(dc_scaled_sec),
intent(out),
optional:: sclyear
173 type(dc_scaled_sec),
intent(out),
optional:: sclmon
174 type(dc_scaled_sec),
intent(out),
optional:: sclday
175 type(dc_scaled_sec),
intent(out),
optional:: sclsec
176 type(dc_scaled_sec),
intent(out),
optional:: sclnondim
177 logical,
intent(out),
optional :: err
178 type(dc_scaled_sec):: imon, isec
180 character(*),
parameter :: subname =
'DCDiffTimeEval1' 184 if (
present(sclnondim) )
then 185 if ( .not. diff % nondim_flag )
then 189 sclnondim = diff % sec
190 elseif (
present(nondim) )
then 191 if ( .not. diff % nondim_flag )
then 197 if ( diff % nondim_flag )
then 205 if (
present(sclyear))
then 208 elseif (
present(year))
then 213 if (
present(sclmon))
then 215 elseif (
present(mon))
then 219 if (
present(sclday))
then 221 elseif (
present(day))
then 224 isec = isec + diff % day * diff % day_seconds
227 if (
present(hour))
then 231 if (
present(min))
then 236 if (
present(sec))
then 239 if (
present(sclsec))
then 256 use dc_scaledsec, only: dc_scaled_sec,
assignment(=),
operator(/),
operator(+)
259 type(dc_datetime),
intent(in):: time
260 type(dc_scaled_sec):: day, sec
262 call eval(time, sclday = day, sclsec = sec)
263 result = day + sec / time % day_seconds
276 use dc_scaledsec, only: dc_scaled_sec,
assignment(=),
operator(/), &
277 &
operator(+),
operator(*), int
280 type(dc_difftime),
intent(in):: diff
281 type(dc_scaled_sec):: day, mon, sec
283 call eval(diff, sclmon = mon, sclday = day, sclsec = sec)
284 result = int(mon *
cyclic_mdays) + day + sec / diff % day_seconds
297 use dc_scaledsec, only: dc_scaled_sec,
assignment(=),
operator(/), &
298 &
operator(+),
operator(*), int
301 type(dc_datetime),
intent(in):: time
302 type(dc_scaled_sec):: day, sec
304 call eval(time, sclday = day, sclsec = sec)
305 result = (day * time % day_seconds + sec) /
hour_seconds 319 use dc_scaledsec, only: dc_scaled_sec,
assignment(=),
operator(/), &
320 &
operator(+),
operator(*), int
323 type(dc_difftime),
intent(in):: diff
324 type(dc_scaled_sec):: mon, day, sec
326 call eval(diff, sclmon = mon, sclday = day, sclsec = sec)
341 use dc_scaledsec, only: dc_scaled_sec,
assignment(=),
operator(/), &
342 &
operator(+),
operator(*), int
345 type(dc_datetime),
intent(in):: time
346 type(dc_scaled_sec):: day, sec
348 call eval(time, sclday = day, sclsec = sec)
349 result = (day * time % day_seconds + sec) /
min_seconds 363 use dc_scaledsec, only: dc_scaled_sec,
assignment(=),
operator(/), &
364 &
operator(+),
operator(*), int
367 type(dc_difftime),
intent(in):: diff
368 type(dc_scaled_sec):: mon, day, sec
370 call eval(diff, sclmon = mon, sclday = day, sclsec = sec)
391 type(dc_datetime),
intent(in):: time
393 real(DP):: sec, day_seconds
395 call eval(time, day = day, sec = sec)
396 day_seconds = time % day_seconds
397 result = day * day_seconds + sec
413 type(dc_difftime),
intent(in):: diff
415 real(DP):: sec, day_seconds
417 if ( .not. diff % nondim_flag )
then 418 call eval(diff, mon = mon, day = day, sec = sec)
419 day_seconds = diff % day_seconds
420 result = int(mon *
cyclic_mdays) + day * day_seconds + sec
422 call eval(diff, nondim = result)
438 type(dc_difftime),
intent(in):: diff
441 call eval(diff, nondim=nondim)
458 &
operator(+),
operator(*), int
460 type(dc_scaled_sec):: result
461 type(dc_datetime),
intent(in):: time
462 type(dc_scaled_sec):: day, sec
464 call eval(time, sclday = day, sclsec = sec)
465 result = day * time % day_seconds + sec
479 &
operator(==),
operator(+),
operator(*), int
481 type(dc_scaled_sec):: result
482 type(dc_difftime),
intent(in):: diff
483 type(dc_scaled_sec):: mon, day, sec
484 type(dc_scaled_sec):: zero_sec
486 if ( .not. diff % nondim_flag )
then 487 call eval(diff, sclmon = mon, sclday = day, sclsec = sec)
488 if ( mon == zero_sec )
then 489 result = day * diff % day_seconds + sec
491 result = ( int(mon *
cyclic_mdays) + day ) * diff % day_seconds + sec
494 call eval(diff, sclnondim = sec)
525 type(dc_datetime),
intent(in):: time
526 character(*),
intent(in):: unit
527 integer,
intent(in),
optional:: unit_symbol
531 if (
present(unit_symbol) )
then 579 type(dc_difftime),
intent(in):: diff
580 character(*),
intent(in):: unit
581 integer,
intent(in),
optional:: unit_symbol
585 if (
present(unit_symbol) )
then integer, parameter, public cal_noleap
integer, parameter, public unit_symbol_nondim
integer, parameter, public unit_symbol_err
integer, parameter, public unit_symbol_min
integer, parameter, public token
Character length for word, token.
integer, parameter, public four_century
integer, parameter, public year_months
real(dp) function dcdifftimeevalbyunit(diff, unit, unit_symbol)
integer, parameter, public unit_symbol_hour
real(dp) function dcdifftimeevalnondim(diff)
integer, parameter, public cal_julian
integer, parameter, public cal_cyclic
type(dc_scaled_sec) function dcdifftimeevalsclsec(diff)
real(dp) function dcdatetimeevalbyunit(time, unit, unit_symbol)
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public dc_noerr
real(dp), parameter, public cyclic_mdays
subroutine dcdatetimeeval1(time, year, mon, day, hour, min, sec, caltype, zone, sclyear, sclmon, sclday, sclsec)
real(dp) function dcdatetimeevalmin(time)
integer, parameter, public dp
Double Precision Real number.
real(dp) function dcdatetimeevalhour(time)
integer, parameter, public hour_seconds
integer, parameter, public year_days
type(dc_scaled_sec) function dcdatetimeevalsclsec(time)
real(dp) function dcdifftimeevalsec(diff)
real(dp) function dcdifftimeevalday(diff)
Provides kind type parameter values.
integer, parameter, public unit_symbol_sec
real(dp) function dcdifftimeevalmin(diff)
integer, parameter, public unit_symbol_day
integer, parameter, public dc_edimtime
real(dp) function dcdifftimeevalhour(diff)
integer, parameter, public four_years
real(dp) function dcdatetimeevalsec(time)
subroutine, public dcscaledsecputline(sclsec, unit, indent)
integer, parameter, public dc_enodimtime
integer, parameter, public min_seconds
subroutine dcdifftimeeval1(diff, year, mon, day, hour, min, sec, nondim, sclyear, sclmon, sclday, sclsec, sclnondim, err)
real(dp) function dcdatetimeevalday(time)