36 public :: calendarymdhms2sec
37 public :: calendarsec2ymdhms
39 interface calendarymdhms2sec
40 module procedure calendarymdhms2secsp
41 module procedure calendarymdhms2secdp
42 end interface calendarymdhms2sec
44 interface calendarsec2ymdhms
45 module procedure calendarsec2ymdhmssp
46 module procedure calendarsec2ymdhmsdp
47 end interface calendarsec2ymdhms
61 real(DP),
private,
parameter :: TIME_HOUR = 24.d0
62 real(DP),
private,
parameter :: TIME_MIN = 60.d0
63 real(DP),
private,
parameter :: TIME_SEC = 60.d0
65 character(len=LOG_LMSG),
private :: message
84 subroutine calendarymdhms2secsp( &
90 real(
sp),
intent(out) :: second
91 real(
sp),
intent( in) :: value
92 character(len=*),
intent( in) :: unit
95 select case(trim(unit))
97 second =
value * 1.0e-3_sp
101 second =
value * time_sec
102 case(
'HOUR',
'hour',
'h')
103 second =
value * time_sec * time_min
105 second =
value * time_sec * time_min * time_hour
107 write(message,*)
' xxx Unsupported UNIT:', trim(unit),
value
108 call log(
'E', message)
112 end subroutine calendarymdhms2secsp
113 subroutine calendarymdhms2secdp( &
119 real(dp),
intent(out) :: second
120 real(dp),
intent( in) :: value
121 character(len=*),
intent( in) :: unit
124 select case(trim(unit))
126 second =
value * 1.0e-3_dp
127 case(
'SEC',
'sec',
's')
130 second =
value * time_sec
131 case(
'HOUR',
'hour',
'h')
132 second =
value * time_sec * time_min
134 second =
value * time_sec * time_min * time_hour
136 write(message,*)
' xxx Unsupported UNIT:', trim(unit),
value
137 call log(
'E', message)
141 end subroutine calendarymdhms2secdp
149 subroutine calendarsec2ymdhmssp( &
155 real(
sp),
intent(out) :: value
156 real(
sp),
intent( in) :: second
157 character(len=*),
intent( in) :: unit
160 select case(trim(unit))
162 value = second / 1.0e-3_sp
163 case(
'SEC',
'seconds',
'sec',
's')
165 case(
'MIN',
'mins',
'min')
166 value = second / time_sec
167 case(
'HOUR',
'hours',
'hour',
'h')
168 value = second / (time_sec * time_min)
169 case(
'DAY',
'days',
'day')
170 value = second / (time_sec * time_min * time_hour)
172 write(message,*)
' xxx Unsupported UNIT:', trim(unit),
value
173 call log(
'E', message)
177 end subroutine calendarsec2ymdhmssp
178 subroutine calendarsec2ymdhmsdp( &
184 real(dp),
intent(out) :: value
185 real(dp),
intent( in) :: second
186 character(len=*),
intent( in) :: unit
189 select case(trim(unit))
191 value = second / 1.0e-3_dp
192 case(
'SEC',
'seconds',
'sec',
's')
194 case(
'MIN',
'mins',
'min')
195 value = second / time_sec
196 case(
'HOUR',
'hours',
'hour',
'h')
197 value = second / (time_sec * time_min)
198 case(
'DAY',
'days',
'day')
199 value = second / (time_sec * time_min * time_hour)
201 write(message,*)
' xxx Unsupported UNIT:', trim(unit),
value
202 call log(
'E', message)
206 end subroutine calendarsec2ymdhmsdp