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

Conversion from DC_DATETIME/DC_DIFFTIME to date/time components. More...

Go to the source code of this file.

Functions/Subroutines

subroutine dcdatetimeeval1 (time, year, mon, day, hour, min, sec, caltype, zone, sclyear, sclmon, sclday, sclsec)
subroutine dcdifftimeeval1 (diff, year, mon, day, hour, min, sec, nondim, sclyear, sclmon, sclday, sclsec, sclnondim, err)
real(dp) function dcdatetimeevalday (time)
real(dp) function dcdifftimeevalday (diff)
real(dp) function dcdatetimeevalhour (time)
real(dp) function dcdifftimeevalhour (diff)
real(dp) function dcdatetimeevalmin (time)
real(dp) function dcdifftimeevalmin (diff)
real(dp) function dcdatetimeevalsec (time)
real(dp) function dcdifftimeevalsec (diff)
real(dp) function dcdifftimeevalnondim (diff)
type(dc_scaled_sec) function dcdatetimeevalsclsec (time)
type(dc_scaled_sec) function dcdifftimeevalsclsec (diff)
real(dp) function dcdatetimeevalbyunit (time, unit, unit_symbol)
real(dp) function dcdifftimeevalbyunit (diff, unit, unit_symbol)

Detailed Description

Conversion from DC_DATETIME/DC_DIFFTIME to date/time components.

Author
Yasuhiro MORIKAWA, Eizi TOYODA

Procedures provided in this file are available through dc_date module.

Definition in file dcdatetimeeval.f90.

Function/Subroutine Documentation

◆ dcdatetimeeval1()

subroutine dcdatetimeeval1 ( type(dc_datetime), intent(in) time,
integer, intent(out), optional year,
integer, intent(out), optional mon,
integer, intent(out), optional day,
integer, intent(out), optional hour,
integer, intent(out), optional min,
real(dp), intent(out), optional sec,
integer, intent(out), optional caltype,
character(*), intent(out), optional zone,
type(dc_scaled_sec), 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 )

Convert DC_DATETIME to date/time components

Converts DC_DATETIME variable time to year, month, day, hour, minute, second, calendar type, and timezone.

Parameters
[in]timeDC_DATETIME variable to convert
[out]yearYear (optional)
[out]monMonth (optional)
[out]dayDay (optional)
[out]hourHour (optional)
[out]minMinute (optional)
[out]secSecond (optional)
[out]caltypeCalendar type (optional)
[out]zoneTimezone (offset from UTC) (optional)
[out]sclyearYear as DC_SCALED_SEC (optional)
[out]sclmonMonth as DC_SCALED_SEC (optional)
[out]scldayDay as DC_SCALED_SEC (optional)
[out]sclsecSecond as DC_SCALED_SEC (optional)

Definition at line 63 of file dcdatetimeeval.f90.

65 use dc_types, only: dp
66 use dc_date_types, only: dc_datetime, &
70 use dc_scaledsec, only: dc_scaled_sec, &
71 & assignment(=), dcscaledsecputline, &
72 & operator(==), operator(>), operator(<), operator(>=), operator(<=), &
73 & operator(+), operator(-), operator(*), operator(/), mod, modulo, &
74 & abs, int, floor, ceiling
75 use dc_trace, only: beginsub, endsub
76 implicit none
77 type(DC_DATETIME), intent(in):: time
78 integer, intent(out), optional:: year ! 年
79 integer, intent(out), optional:: mon ! 月
80 integer, intent(out), optional:: day ! 日
81 integer, intent(out), optional:: hour ! 時
82 integer, intent(out), optional:: min ! 分
83 real(DP),intent(out), optional:: sec ! 秒
84 integer, intent(out), optional:: caltype ! 暦法
85 character(*), intent(out), optional:: zone ! タイムゾーン (UTC からの時差)
86 type(DC_SCALED_SEC), intent(out), optional:: sclyear ! 年 (DC_SCALED_SEC 型)
87 type(DC_SCALED_SEC), intent(out), optional:: sclmon ! 月 (DC_SCALED_SEC 型)
88 type(DC_SCALED_SEC), intent(out), optional:: sclday ! 日 (DC_SCALED_SEC 型)
89 type(DC_SCALED_SEC), intent(out), optional:: sclsec ! 秒 (DC_SCALED_SEC 型)
90
91 type(DC_SCALED_SEC):: iyear, month, iday, imon, isec
92 !character(*), parameter :: subname = 'DCDateTimeEval1'
93continue
94 !call BeginSub(subname)
95 if (present(zone)) then
96 zone = time % zone
97 end if
98 if (present(caltype)) then
99 caltype = time % caltype
100 end if
101 isec = time % sec
102 if (present(hour)) then
103 hour = floor(isec / hour_seconds)
104 isec = modulo(isec, hour_seconds)
105 end if
106 if (present(min)) then
107 min = floor(isec / min_seconds)
108 isec = modulo(isec, min_seconds)
109 end if
110 if (present(sec)) then
111 sec = isec
112 end if
113 if (present(sclsec)) then
114 sclsec = isec
115 end if
116
117 if (time % caltype == cal_cyclic) then
118 iday = time % day
119 if (present(year)) year = 0
120 if (present(sclyear)) sclyear = 0
121 if (present(sclmon)) then
122 sclmon = floor(iday / cyclic_mdays)
123 iday = ceiling( modulo(iday, cyclic_mdays) )
124 elseif (present(mon)) then
125 mon = floor(iday / cyclic_mdays)
126 iday = ceiling( modulo(iday, cyclic_mdays) )
127 end if
128 if (present(day)) day = iday
129 if (present(sclday)) sclday = iday
130 goto 999
131 endif
132 if (time % caltype == cal_noleap) then
133 iday = int( modulo(time%day - 91, year_days) )
134 iyear = int( (time%day - 91 - iday) / year_days )
135 else
136 if (time % caltype == cal_julian) then
137 iday = int( modulo(time%day - 92, four_years) )
138 iyear = int( (time%day - 92 - iday) / four_years ) * 4
139 elseif (time%day < 640196) then
140 iday = int( modulo(time%day - 92, four_years) )
141 iyear = int( (time%day - 92 - iday) / four_years ) * 4
142 else
143 iday = int( modulo(time%day - 94, four_century) )
144 iyear = int( (time%day - 94 - iday) / four_century ) * 400
145 if (iday == four_century - 1) then
146 iyear = iyear + 300
147 iday = 36525
148 else
149 iyear = iyear + int( iday / 36524 ) * 100
150 iday = int( modulo(iday, 36524) )
151 endif
152 iyear = iyear + int( iday / four_years ) * 4
153 iday = int( modulo(iday, four_years) )
154 endif
155 if (iday == four_years - 1) then
156 iyear = iyear + 3
157 iday = year_days
158 else
159 iyear = iyear + int( iday / year_days )
160 iday = int( modulo(iday, year_days) )
161 endif
162 endif
163
164 iday = iday * 10 + 922
165 month = int( iday / 306 )
166
167 if (present(sclyear)) then
168 imon = mod(month - 1, year_months) + 1
169 sclyear = iyear + int( (month - imon) / year_months )
170 elseif (present(year)) then
171 imon = mod(month - 1, year_months) + 1
172 year = iyear + int( (month - imon) / year_months )
173 else
174 imon = month
175 end if
176 if (present(sclmon)) then
177 iday = int( mod(iday, 306) / 10 ) + 1
178 sclmon = imon
179 elseif (present(mon)) then
180 iday = int( mod(iday, 306) / 10 ) + 1
181 mon = imon
182 else
183 iday = int( iday / 10 ) + 1
184 end if
185
186 if (present(day)) day = iday
187 if (present(sclday)) sclday = iday
188
189999 continue
190 !call EndSub(subname)
Derived types and parameters for date and time.
integer, parameter, public cal_noleap
Calendar without leap years (365 days per year)
real(dp), parameter, public cyclic_mdays
Days per month for cyclic calendar (also used for DC_DIFFTIME)
integer, parameter, public hour_seconds
Seconds per hour
integer, parameter, public four_years
Days in 4 years (including leap year)
integer, parameter, public cal_cyclic
Cyclic calendar (30.6 days per month)
integer, save, public caltype
Default calendar type (Gregorian)
integer, parameter, public year_days
Days per year (non-leap year)
integer, parameter, public year_months
Months per year
integer, parameter, public four_century
Days in 400 years
integer, parameter, public min_seconds
Seconds per minute
integer, parameter, public cal_julian
Julian calendar
Scaled seconds module for precise time operations.
subroutine, public dcscaledsecputline(sclsec, unit, indent)
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:457
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:580
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92

References dc_trace::beginsub(), dc_date_types::cal_cyclic, dc_date_types::cal_julian, dc_date_types::cal_noleap, dc_date_types::cyclic_mdays, dc_scaledsec::dcscaledsecputline(), dc_types::dp, dc_trace::endsub(), dc_date_types::four_century, dc_date_types::four_years, dc_date_types::hour_seconds, dc_date_types::min_seconds, dc_date_types::year_days, and dc_date_types::year_months.

Here is the call graph for this function:

◆ dcdatetimeevalbyunit()

real(dp) function dcdatetimeevalbyunit ( type(dc_datetime), intent(in) time,
character(*), intent(in) unit,
integer, intent(in), optional unit_symbol )

Convert DC_DATETIME by specified unit

Converts DC_DATETIME variable to the specified unit and returns as double precision real.

For unit, the following values can be specified:

  • dc_date_types#UNIT_DAY (day)
  • dc_date_types#UNIT_HOUR (hour)
  • dc_date_types#UNIT_MIN (minute)
  • dc_date_types#UNIT_SEC (second)

For unit_symbol, the following values can be specified:

  • dc_date_types#UNIT_SYMBOL_DAY (day)
  • dc_date_types#UNIT_SYMBOL_HOUR (hour)
  • dc_date_types#UNIT_SYMBOL_MIN (minute)
  • dc_date_types#UNIT_SYMBOL_SEC (second)

Returns 0.0 if invalid unit is specified or neither argument is given.

Parameters
[in]timeDC_DATETIME variable to convert
[in]unitUnit string
[in]unit_symbolUnit symbol constant (optional)
Returns
Converted value as double precision real

Definition at line 807 of file dcdatetimeeval.f90.

808 use dc_types, only: dp
810 use dc_date_types, only: dc_datetime, &
813 implicit none
814 real(DP):: result
815 type(DC_DATETIME), intent(in):: time
816 character(*), intent(in):: unit
817 integer, intent(in), optional:: unit_symbol
818 integer:: symbol
819continue
820 symbol = unit_symbol_err
821 if ( present(unit_symbol) ) then
822 symbol = unit_symbol
823 else
824 symbol = parsetimeunits(unit)
825 end if
826
827 if ( symbol == unit_symbol_sec ) then
828 result = evalsec(time)
829 elseif ( symbol == unit_symbol_min ) then
830 result = evalmin(time)
831 elseif ( symbol == unit_symbol_hour ) then
832 result = evalhour(time)
833 elseif ( symbol == unit_symbol_day ) then
834 result = evalday(time)
835 else
836 result = 0.0_dp
837 end if
Interface declarations for procedures provided from dc_date.
integer, parameter, public unit_symbol_err
Symbol for invalid unit
integer, parameter, public unit_symbol_hour
Symbol for hour unit
integer, parameter, public unit_symbol_min
Symbol for minute unit
integer, parameter, public unit_symbol_sec
Symbol for second unit
integer, parameter, public unit_symbol_day
Symbol for day unit

References dc_types::dp, dc_date_types::unit_symbol_day, dc_date_types::unit_symbol_err, dc_date_types::unit_symbol_hour, dc_date_types::unit_symbol_min, and dc_date_types::unit_symbol_sec.

◆ dcdatetimeevalday()

real(dp) function dcdatetimeevalday ( type(dc_datetime), intent(in) time)

Convert DC_DATETIME to days

Converts DC_DATETIME variable to number of days as double precision real. (e.g., 12 hours is converted to 0.5 days)

Parameters
[in]timeDC_DATETIME variable to convert
Returns
Number of days as double precision real

Definition at line 354 of file dcdatetimeeval.f90.

355 use dc_types, only: dp
356 use dc_date_generic, only: eval
357 use dc_date_types, only: dc_datetime
358 use dc_scaledsec, only: dc_scaled_sec, assignment(=), operator(/), operator(+)
359 implicit none
360 real(DP):: result
361 type(DC_DATETIME), intent(in):: time
362 type(DC_SCALED_SEC):: day, sec
363continue
364 call eval(time, sclday = day, sclsec = sec)
365 result = day + sec / time % day_seconds

References dc_types::dp.

◆ dcdatetimeevalhour()

real(dp) function dcdatetimeevalhour ( type(dc_datetime), intent(in) time)

Convert DC_DATETIME to hours

Converts DC_DATETIME variable to hours as double precision real. (e.g., 2 days is 48 hours, 30 minutes is 0.5 hours)

Parameters
[in]timeDC_DATETIME variable to convert
Returns
Number of hours as double precision real

Definition at line 426 of file dcdatetimeeval.f90.

427 use dc_types, only: dp
428 use dc_date_generic, only: eval
430 use dc_scaledsec, only: dc_scaled_sec, assignment(=), operator(/), &
431 & operator(+), operator(*), int
432 implicit none
433 real(DP):: result
434 type(DC_DATETIME), intent(in):: time
435 type(DC_SCALED_SEC):: day, sec
436continue
437 call eval(time, sclday = day, sclsec = sec)
438 result = (day * time % day_seconds + sec) / hour_seconds

References dc_types::dp, and dc_date_types::hour_seconds.

◆ dcdatetimeevalmin()

real(dp) function dcdatetimeevalmin ( type(dc_datetime), intent(in) time)

Convert DC_DATETIME to minutes

Converts DC_DATETIME variable to minutes as double precision real. (e.g., 1 day is 1440 minutes, 30 seconds is 0.5 minutes)

Parameters
[in]timeDC_DATETIME variable to convert
Returns
Number of minutes as double precision real

Definition at line 500 of file dcdatetimeeval.f90.

501 use dc_types, only: dp
502 use dc_date_generic, only: eval
504 use dc_scaledsec, only: dc_scaled_sec, assignment(=), operator(/), &
505 & operator(+), operator(*), int
506 implicit none
507 real(DP):: result
508 type(DC_DATETIME), intent(in):: time
509 type(DC_SCALED_SEC):: day, sec
510continue
511 call eval(time, sclday = day, sclsec = sec)
512 result = (day * time % day_seconds + sec) / min_seconds

References dc_types::dp, and dc_date_types::min_seconds.

◆ dcdatetimeevalsclsec()

type(dc_scaled_sec) function dcdatetimeevalsclsec ( type(dc_datetime), intent(in) time)

Convert DC_DATETIME to seconds as DC_SCALED_SEC

Converts DC_DATETIME variable to seconds as DC_SCALED_SEC type.

Warning
The year component is ignored. i.e., time containing 1999-01-01 and time containing 2007-01-01 return the same value. (This may not be the desired behavior)
Parameters
[in]timeDC_DATETIME variable to convert
Returns
Seconds as DC_SCALED_SEC type

Definition at line 696 of file dcdatetimeeval.f90.

697 use dc_date_generic, only: eval
698 use dc_date_types, only: dc_datetime
699 use dc_scaledsec, only: dc_scaled_sec, operator(/), &
700 & operator(+), operator(*), int
701 implicit none
702 type(DC_SCALED_SEC):: result
703 type(DC_DATETIME), intent(in):: time
704 type(DC_SCALED_SEC):: day, sec
705continue
706 call eval(time, sclday = day, sclsec = sec)
707 result = day * time % day_seconds + sec

◆ dcdatetimeevalsec()

real(dp) function dcdatetimeevalsec ( type(dc_datetime), intent(in) time)

Convert DC_DATETIME to seconds

Converts DC_DATETIME variable to seconds as double precision real.

Warning
The year component is ignored. i.e., time containing 1999-01-01 and time containing 2007-01-01 return the same value. (This may not be the desired behavior)
Parameters
[in]timeDC_DATETIME variable to convert
Returns
Number of seconds as double precision real

Definition at line 580 of file dcdatetimeeval.f90.

581 use dc_types, only: dp
582 use dc_date_generic, only: eval
583 use dc_date_types, only: dc_datetime
584 use dc_scaledsec, only: assignment(=)
585 implicit none
586 real(DP):: result
587 type(DC_DATETIME), intent(in):: time
588 integer:: day
589 real(DP):: sec, day_seconds
590continue
591 call eval(time, day = day, sec = sec)
592 day_seconds = time % day_seconds
593 result = day * day_seconds + sec
real(dp), save, public day_seconds
Seconds per day (variable, default is Earth day)

References dc_date_types::day_seconds, and dc_types::dp.

◆ dcdifftimeeval1()

subroutine dcdifftimeeval1 ( type(dc_difftime), intent(in) diff,
integer, intent(out), optional year,
integer, intent(out), optional mon,
integer, intent(out), optional day,
integer, intent(out), optional hour,
integer, intent(out), optional min,
real(dp), intent(out), optional sec,
real(dp), intent(out), optional nondim,
type(dc_scaled_sec), 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,
logical, intent(out), optional err )

Convert DC_DIFFTIME to time components

Converts DC_DIFFTIME variable diff to year, month, day, hour, minute, second, and nondimensional time.

Parameters
[in]diffDC_DIFFTIME variable to convert
[out]yearYear (optional)
[out]monMonth (optional)
[out]dayDay (optional)
[out]hourHour (optional)
[out]minMinute (optional)
[out]secSecond (optional)
[out]nondimNondimensional time (optional)
[out]sclyearYear as DC_SCALED_SEC (optional)
[out]sclmonMonth as DC_SCALED_SEC (optional)
[out]scldayDay as DC_SCALED_SEC (optional)
[out]sclsecSecond as DC_SCALED_SEC (optional)
[out]sclnondimNondimensional time as DC_SCALED_SEC (optional)
[out]errError flag (optional)

Definition at line 237 of file dcdatetimeeval.f90.

240 use dc_types, only: dp
241 use dc_trace, only: beginsub, endsub
243 use dc_date_types, only: dc_difftime, &
245 use dc_scaledsec, only: dc_scaled_sec, &
246 & assignment(=), dcscaledsecputline, &
247 & operator(==), operator(>), operator(<), operator(>=), operator(<=), &
248 & operator(+), operator(-), operator(*), operator(/), mod, modulo, &
249 & abs, int, floor, ceiling
250 implicit none
251 type(DC_DIFFTIME), intent(in):: diff
252 integer, intent(out), optional:: year ! 年
253 integer, intent(out), optional:: mon ! 月
254 integer, intent(out), optional:: day ! 日
255 integer, intent(out), optional:: hour ! 時
256 integer, intent(out), optional:: min ! 分
257 real(DP),intent(out), optional:: sec ! 秒
258 real(DP),intent(out), optional:: nondim ! 無次元時間. Nondimensional time
259 type(DC_SCALED_SEC), intent(out), optional:: sclyear ! 年 (DC_SCALED_SEC 型)
260 type(DC_SCALED_SEC), intent(out), optional:: sclmon ! 月 (DC_SCALED_SEC 型)
261 type(DC_SCALED_SEC), intent(out), optional:: sclday ! 日 (DC_SCALED_SEC 型)
262 type(DC_SCALED_SEC), intent(out), optional:: sclsec ! 秒 (DC_SCALED_SEC 型)
263 type(DC_SCALED_SEC), intent(out), optional:: sclnondim ! 無次元時間 (DC_SCALED_SEC 型)
264 logical, intent(out), optional :: err
265 type(DC_SCALED_SEC):: imon, isec
266 integer:: stat
267 character(*), parameter :: subname = 'DCDiffTimeEval1'
268continue
269 !call BeginSub(subname)
270 stat = dc_noerr
271 if ( present(sclnondim) ) then
272 if ( .not. diff % nondim_flag ) then
273 stat = dc_edimtime
274 goto 999
275 end if
276 sclnondim = diff % sec
277 elseif ( present(nondim) ) then
278 if ( .not. diff % nondim_flag ) then
279 stat = dc_edimtime
280 goto 999
281 end if
282 nondim = diff % sec
283 else
284 if ( diff % nondim_flag ) then
285 stat = dc_enodimtime
286 goto 999
287 end if
288 end if
289
290 imon = diff % mon
291 isec = diff % sec
292 if (present(sclyear)) then
293 sclyear = int( imon / year_months )
294 imon = mod(imon, year_months)
295 elseif (present(year)) then
296 year = int( imon / year_months )
297 imon = mod(imon, year_months)
298 endif
299
300 if (present(sclmon)) then
301 sclmon = imon
302 elseif (present(mon)) then
303 mon = imon
304 endif
305
306 if (present(sclday)) then
307 sclday = diff % day
308 elseif (present(day)) then
309 day = diff % day
310 else
311 isec = isec + diff % day * diff % day_seconds
312 endif
313
314 if (present(hour)) then
315 hour = int(isec / hour_seconds)
316 isec = mod(isec, hour_seconds)
317 endif
318 if (present(min)) then
319 min = int(isec / min_seconds)
320 isec = mod(isec, min_seconds)
321 endif
322
323 if (present(sec)) then
324 sec = isec
325 endif
326 if (present(sclsec)) then
327 sclsec = isec
328 endif
329999 continue
330 call storeerror(stat, subname, err)
331 !call EndSub(subname)
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_enodimtime
Definition dc_error.f90:549
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
integer, parameter, public dc_edimtime
Definition dc_error.f90:550

References dc_trace::beginsub(), dc_error::dc_edimtime, dc_error::dc_enodimtime, dc_error::dc_noerr, dc_scaledsec::dcscaledsecputline(), dc_types::dp, dc_trace::endsub(), dc_date_types::hour_seconds, dc_date_types::min_seconds, dc_error::storeerror(), and dc_date_types::year_months.

Here is the call graph for this function:

◆ dcdifftimeevalbyunit()

real(dp) function dcdifftimeevalbyunit ( type(dc_difftime), intent(in) diff,
character(*), intent(in) unit,
integer, intent(in), optional unit_symbol )

Convert DC_DIFFTIME by specified unit

Converts DC_DIFFTIME variable to the specified unit and returns as double precision real.

For unit, the following values can be specified:

  • dc_date_types#UNIT_DAY (day)
  • dc_date_types#UNIT_HOUR (hour)
  • dc_date_types#UNIT_MIN (minute)
  • dc_date_types#UNIT_SEC (second)
  • dc_date_types#UNIT_NONDIM (nondimensional)

For unit_symbol, the following values can be specified:

  • dc_date_types#UNIT_SYMBOL_DAY (day)
  • dc_date_types#UNIT_SYMBOL_HOUR (hour)
  • dc_date_types#UNIT_SYMBOL_MIN (minute)
  • dc_date_types#UNIT_SYMBOL_SEC (second)
  • dc_date_types#UNIT_SYMBOL_NONDIM (nondimensional)

Returns 0.0 if invalid unit is specified or neither argument is given.

Parameters
[in]diffDC_DIFFTIME variable to convert
[in]unitUnit string
[in]unit_symbolUnit symbol constant (optional)
Returns
Converted value as double precision real

Definition at line 897 of file dcdatetimeeval.f90.

898 use dc_types, only: dp
901 use dc_date_types, only: dc_difftime, &
904 implicit none
905 real(DP):: result
906 type(DC_DIFFTIME), intent(in):: diff
907 character(*), intent(in):: unit
908 integer, intent(in), optional:: unit_symbol
909 integer:: symbol
910continue
911 symbol = unit_symbol_err
912 if ( present(unit_symbol) ) then
913 symbol = unit_symbol
914 else
915 symbol = parsetimeunits(unit)
916 end if
917
918 if ( symbol == unit_symbol_nondim ) then
919 result = evalnondim(diff)
920 elseif ( symbol == unit_symbol_sec ) then
921 result = evalsec(diff)
922 elseif ( symbol == unit_symbol_min ) then
923 result = evalmin(diff)
924 elseif ( symbol == unit_symbol_hour ) then
925 result = evalhour(diff)
926 elseif ( symbol == unit_symbol_day ) then
927 result = evalday(diff)
928 else
929 result = 0.0_dp
930 end if
integer, parameter, public unit_symbol_nondim
Symbol for nondimensional unit

References dc_types::dp, dc_date_types::unit_symbol_day, dc_date_types::unit_symbol_err, dc_date_types::unit_symbol_hour, dc_date_types::unit_symbol_min, dc_date_types::unit_symbol_nondim, and dc_date_types::unit_symbol_sec.

◆ dcdifftimeevalday()

real(dp) function dcdifftimeevalday ( type(dc_difftime), intent(in) diff)

Convert DC_DIFFTIME to days

Converts DC_DIFFTIME variable to number of days as double precision real. (e.g., 12 hours is converted to 0.5 days)

One month is converted using dc_date_types#CYCLIC_MDAYS.

Parameters
[in]diffDC_DIFFTIME variable to convert
Returns
Number of days as double precision real

Definition at line 391 of file dcdatetimeeval.f90.

392 use dc_types, only: dp
393 use dc_date_generic, only: eval
395 use dc_scaledsec, only: dc_scaled_sec, assignment(=), operator(/), &
396 & operator(+), operator(*), int
397 implicit none
398 real(DP):: result
399 type(DC_DIFFTIME), intent(in):: diff
400 type(DC_SCALED_SEC):: day, mon, sec
401continue
402 call eval(diff, sclmon = mon, sclday = day, sclsec = sec)
403 result = int(mon * cyclic_mdays) + day + sec / diff % day_seconds

References dc_date_types::cyclic_mdays, and dc_types::dp.

◆ dcdifftimeevalhour()

real(dp) function dcdifftimeevalhour ( type(dc_difftime), intent(in) diff)

Convert DC_DIFFTIME to hours

Converts DC_DIFFTIME variable to hours as double precision real. (e.g., 2 days is 48 hours, 30 minutes is 0.5 hours)

One month is converted using dc_date_types#CYCLIC_MDAYS.

Parameters
[in]diffDC_DIFFTIME variable to convert
Returns
Number of hours as double precision real

Definition at line 464 of file dcdatetimeeval.f90.

465 use dc_types, only: dp
466 use dc_date_generic, only: eval
468 use dc_scaledsec, only: dc_scaled_sec, assignment(=), operator(/), &
469 & operator(+), operator(*), int
470 implicit none
471 real(DP):: result
472 type(DC_DIFFTIME), intent(in):: diff
473 type(DC_SCALED_SEC):: mon, day, sec
474continue
475 call eval(diff, sclmon = mon, sclday = day, sclsec = sec)
476 result = ( int(mon * cyclic_mdays) + day &
477 & * diff % day_seconds + sec) / hour_seconds

References dc_date_types::cyclic_mdays, dc_types::dp, and dc_date_types::hour_seconds.

◆ dcdifftimeevalmin()

real(dp) function dcdifftimeevalmin ( type(dc_difftime), intent(in) diff)

Convert DC_DIFFTIME to minutes

Converts DC_DIFFTIME variable to minutes as double precision real. (e.g., 1 day is 1440 minutes, 30 seconds is 0.5 minutes)

One month is converted using dc_date_types#CYCLIC_MDAYS.

Parameters
[in]diffDC_DIFFTIME variable to convert
Returns
Number of minutes as double precision real

Definition at line 538 of file dcdatetimeeval.f90.

539 use dc_types, only: dp
540 use dc_date_generic, only: eval
542 use dc_scaledsec, only: dc_scaled_sec, assignment(=), operator(/), &
543 & operator(+), operator(*), int
544 implicit none
545 real(DP):: result
546 type(DC_DIFFTIME), intent(in):: diff
547 type(DC_SCALED_SEC):: mon, day, sec
548continue
549 call eval(diff, sclmon = mon, sclday = day, sclsec = sec)
550 result = ( int(mon * cyclic_mdays) + day &
551 & * diff % day_seconds + sec) / min_seconds

References dc_date_types::cyclic_mdays, dc_types::dp, and dc_date_types::min_seconds.

◆ dcdifftimeevalnondim()

real(dp) function dcdifftimeevalnondim ( type(dc_difftime), intent(in) diff)

Convert DC_DIFFTIME to nondimensional time

Converts DC_DIFFTIME variable to nondimensional time as double precision real.

One month is converted using dc_date_types#CYCLIC_MDAYS.

Parameters
[in]diffDC_DIFFTIME variable to convert
Returns
Nondimensional time as double precision real

Definition at line 658 of file dcdatetimeeval.f90.

659 use dc_types, only: dp
660 use dc_date_generic, only: eval
661 use dc_date_types, only: dc_difftime
662 implicit none
663 real(DP):: result
664 type(DC_DIFFTIME), intent(in):: diff
665 real(DP):: nondim
666continue
667 call eval(diff, nondim=nondim)
668 result = nondim

References dc_types::dp.

◆ dcdifftimeevalsclsec()

type(dc_scaled_sec) function dcdifftimeevalsclsec ( type(dc_difftime), intent(in) diff)

Convert DC_DIFFTIME to seconds as DC_SCALED_SEC

Converts DC_DIFFTIME variable to seconds as DC_SCALED_SEC type.

One month is converted using dc_date_types#CYCLIC_MDAYS.

Parameters
[in]diffDC_DIFFTIME variable to convert
Returns
Seconds as DC_SCALED_SEC type

Definition at line 731 of file dcdatetimeeval.f90.

732 use dc_date_generic, only: eval
734 use dc_scaledsec, only: dc_scaled_sec, operator(/), &
735 & operator(==), operator(+), operator(*), int
736 implicit none
737 type(DC_SCALED_SEC):: result
738 type(DC_DIFFTIME), intent(in):: diff
739 type(DC_SCALED_SEC):: mon, day, sec
740 type(DC_SCALED_SEC):: zero_sec
741continue
742 if ( .not. diff % nondim_flag ) then
743 call eval(diff, sclmon = mon, sclday = day, sclsec = sec)
744 if ( mon == zero_sec ) then
745 result = day * diff % day_seconds + sec
746 else
747 result = ( int(mon * cyclic_mdays) + day ) * diff % day_seconds + sec
748 end if
749 else
750 call eval(diff, sclnondim = sec)
751 result = sec
752 end if

References dc_date_types::cyclic_mdays.

◆ dcdifftimeevalsec()

real(dp) function dcdifftimeevalsec ( type(dc_difftime), intent(in) diff)

Convert DC_DIFFTIME to seconds

Converts DC_DIFFTIME variable to seconds as double precision real.

One month is converted using dc_date_types#CYCLIC_MDAYS.

Parameters
[in]diffDC_DIFFTIME variable to convert
Returns
Number of seconds as double precision real

Definition at line 617 of file dcdatetimeeval.f90.

618 use dc_types, only: dp
619 use dc_date_generic, only: eval
621 use dc_scaledsec, only: assignment(=)
622 implicit none
623 real(DP):: result
624 type(DC_DIFFTIME), intent(in):: diff
625 integer:: mon, day
626 real(DP):: sec, day_seconds
627continue
628 if ( .not. diff % nondim_flag ) then
629 call eval(diff, mon = mon, day = day, sec = sec)
630 day_seconds = diff % day_seconds
631 result = int(mon * cyclic_mdays) + day * day_seconds + sec
632 else
633 call eval(diff, nondim = result)
634 end if

References dc_date_types::cyclic_mdays, dc_date_types::day_seconds, and dc_types::dp.