Loading...
Searching...
No Matches
dcdatetimecreate.f90
Go to the documentation of this file.
1!== dc_date_types#DC_DATETIME, dc_date_types#DC_DIFFTIME 型変数の生成
2!
3! Authors:: Yasuhiro MORIKAWA, Eizi TOYODA
4! Version:: $Id: dcdatetimecreate.f90,v 1.3 2010-04-11 14:13:51 morikawa Exp $
5! Tag Name:: $Name: $
6! Copyright:: Copyright (C) GFD Dennou Club, 2000-2006. All rights reserved.
7! License:: See COPYRIGHT[link:../../COPYRIGHT]
8!
9! このファイルで提供される手続き群は dc_date モジュールにて提供されます。
10!
11
12subroutine dcdatetimecreate1(time, &
13 & year, mon, day, hour, min, sec, &
14 & zone, zone_hour, zone_min, caltype, caltype_str, day_seconds, &
15 & sclyear, sclmon, sclday, sclsec, err)
16 !
17 ! dc_date_types#DC_DATETIME 型変数の生成を行います.
18 ! 引数 *year*, *mon*, *day*, *hour*, *min*, *sec* の全てを与えない場合,
19 ! このサブルーチンが呼ばれた際の時刻が使用されます.
20 !
21 ! 引数 *caltype* には暦法を設定します.
22 ! dc_date_types#CAL_CYCLIC, dc_date_types#CAL_NOLEAP,
23 ! dc_date_types#CAL_JULIAN, dc_date_types#CAL_GREGORIAN
24 ! のいづれかを与えてください. 引数 *caltype* を指定しない場合, 暦法は
25 ! dc_date_types#CAL_GREGORIAN に設定されます.
26 ! 暦法は *caltype_str* に文字列を与えることでも指定可能です.
27 ! 上記の暦法に対応する文字列は以下の通りです. (大文字小文字は区別しません)
28 !
29 ! dc_date_types#CAL_CYCLIC :: cyclic
30 ! dc_date_types#CAL_NOLEAP :: noleap
31 ! dc_date_types#CAL_JULIAN :: julian
32 ! dc_date_types#CAL_GREGORIAN :: gregorian
33 !
34 ! 引数 *zone* には UTC からの時差を設定します.
35 ! '+09:00' や '-13:00' のように時差を 6 文字で指定してください.
36 ! 引数 *zone* を指定しない場合, date_and_time 組み込みサブルーチン
37 ! によって得られる時差を設定します.
38 ! 時差は *zone_hour* または *zone_min* に整数型を与えることでも
39 ! 指定可能です.
40 !
41 ! 引数 *day_seconds* には 1 日何秒かを設定します. この引数を
42 ! 指定しない場合, dc_date_types#day_seconds の値が用いられます.
43 ! dc_date_types#day_seconds は SetSecOfDay で変更可能です.
44 !
45 ! 引数 *caltype* および, *zone* に不適切な値が与えられた場合,
46 ! エラーを発生させます.
47 ! 引数 *err* を与えている場合には *err* に .true. が返り,
48 ! プログラムは続行します.
49 !
50
55 & caltype_default => caltype, &
60 use dc_message, only: messagenotify
61 use dc_trace, only: beginsub, endsub
62 use dc_present, only: present_select
63 use dc_string, only: lchar, cprintf
64 use dc_scaledsec, only: dc_scaled_sec, &
65 & assignment(=), dcscaledsecputline, &
66 & operator(==), operator(>), operator(<), operator(>=), operator(<=), &
67 & operator(+), operator(-), operator(*), operator(/), mod, modulo, &
69 use dc_types, only: dp, string, token
70 implicit none
71 type(dc_datetime), intent(out) :: time
72 integer, intent(in), optional:: year ! 年
73 integer, intent(in), optional:: mon ! 月
74 integer, intent(in), optional:: day ! 日
75 integer, intent(in), optional:: hour ! 時
76 integer, intent(in), optional:: min ! 分
77 real(DP),intent(in), optional:: sec ! 秒
78 character(*), intent(in), optional :: zone ! UTC からの時差
79 integer, intent(in), optional :: zone_hour ! UTC からの時差 (時)
80 integer, intent(in), optional :: zone_min ! UTC からの時差 (分)
81 integer, intent(in), optional:: caltype ! 暦法
82 character(*), intent(in), optional:: caltype_str ! 暦法 (文字型による指定)
83 real(DP),intent(in), optional:: day_seconds ! 1 日の秒数
84 type(dc_scaled_sec), intent(in), optional:: sclyear ! 年 (DC_SCALED_SEC 型)
85 type(dc_scaled_sec), intent(in), optional:: sclmon ! 月 (DC_SCALED_SEC 型)
86 type(dc_scaled_sec), intent(in), optional:: sclday ! 日 (DC_SCALED_SEC 型)
87 type(dc_scaled_sec), intent(in), optional:: sclsec ! 秒 (DC_SCALED_SEC 型)
88 logical, intent(out), optional:: err
89
90 real(DP):: gcsec
91 integer :: gcday, gcmon, gcyear
92 real(DP):: essec, esds
93 integer :: esday
94 type(dc_scaled_sec):: iday, imon, month, iyear, century, isec
95 character(6) :: izone
96 integer, parameter:: year_default = 0, mon_default = 1
97 integer, parameter:: day_default = 1
98 integer, parameter:: sec_default = 0
99 logical :: current_time_used
100 type(dc_difftime):: zonediff
101 character(TOKEN):: zone_str
102 integer :: stat, cause_i
103 character(STRING) :: cause_c
104 character(*), parameter :: subname = 'DCDateTimeCreate1'
105continue
106 current_time_used = .not. present(year) &
107 & .and. .not. present(mon) &
108 & .and. .not. present(day) &
109 & .and. .not. present(hour) &
110 & .and. .not. present(min) &
111 & .and. .not. present(sec) &
112 & .and. .not. present(sclyear) &
113 & .and. .not. present(sclmon) &
114 & .and. .not. present(sclday) &
115 & .and. .not. present(sclsec)
116 call beginsub(subname, 'current_time_used=<%y>', l=(/current_time_used/))
117 stat = dc_noerr
118 cause_i = dc_noerr
119 cause_c = ''
120
121 if ( present(day_seconds) ) then
122 time % day_seconds = day_seconds
123 else
125 time % day_seconds = day_seconds_scl
126 end if
127
128 call get_current_time(gcyear, gcmon, gcday, gcsec, izone) ! (out)
129 iyear = gcyear
130 imon = gcmon
131 iday = gcday
132 isec = gcsec
133
134 if (.not. current_time_used) then
135 if ( present(zone_hour) .or. present(zone_min) ) then
136 call dcdifftimecreate( zonediff, & ! (out)
137 & hour = zone_hour, min = zone_min ) ! (in)
138 zone_str = tochar(zonediff)
139 if ( zone_str(1:1) == '-' ) then
140 izone(1:1) = '-'
141 else
142 izone(1:1) = '+'
143 end if
144 izone(2:6) = zone_str(13:17)
145 end if
146 if (present(zone)) then
147 izone = zone
148 end if
149 if ( .not. validzone(izone)) then
150 stat = dc_ebadtimezone
151 cause_c = izone
152 if (present(err)) then
153 call messagenotify('W', subname, &
154 & 'zone=<%c> is invalid.', &
155 & c1=trim(izone))
156 else
157 goto 999
158 end if
159 end if
160
161 if ( present(sclsec) ) then
162 isec = sclsec
163 elseif( present(sec) ) then
164 isec = sec
165 else
166 isec = sec_default
167 end if
168 if (present(min)) then
169 isec = isec + min * min_seconds
170 end if
171 if (present(hour)) then
172 isec = isec + hour * hour_seconds
173 end if
174
175 if ( present(sclday) ) then
176 iday = sclday
177 elseif( present(day) ) then
178 iday = day
179 else
180 iday = day_default
181 end if
182
183 if ( present(sclday) ) then
184 iday = sclday
185 elseif( present(day) ) then
186 iday = day
187 else
188 iday = day_default
189 end if
190 iday = iday + floor(isec / time % day_seconds)
191
192 if ( present(sclmon) ) then
193 imon = sclmon
194 elseif( present(mon) ) then
195 imon = mon
196 else
197 imon = mon_default
198 end if
199
200 if ( present(sclyear) ) then
201 iyear = sclyear
202 elseif( present(year) ) then
203 iyear = year
204 else
205 iyear = year_default
206 end if
207 end if
208
209 time % zone = izone
210 time % sec = modulo(isec, time % day_seconds)
211 time % caltype = caltype_default
212 if (present(caltype_str)) then
213 select case( lchar(trim(caltype_str)) )
214 case('cyclic')
215 time % caltype = cal_cyclic
216 case('noleap')
217 time % caltype = cal_noleap
218 case('julian')
219 time % caltype = cal_julian
220 case('gregorian')
221 time % caltype = cal_gregorian
222 case('')
223 time % caltype = cal_gregorian
224 case default
225 stat = dc_ebadcaltype
226 cause_i = 0
227 call messagenotify('W', subname, &
228 & 'caltype=<%c> is invalid calender type.', &
229 & c1 = trim(caltype_str) )
230 if ( .not. present(err) ) then
231 goto 999
232 end if
233 end select
234 end if
235
236 if (present(caltype)) then
237 if (validcaltype(caltype)) then
238 time % caltype = caltype
239 else
240 stat = dc_ebadcaltype
241 cause_i = caltype
242 if (present(err)) then
243 call messagenotify('W', subname, &
244 & 'caltype=<%d> is invalid calender type.', &
245 & i=(/caltype/))
246 else
247 goto 999
248 end if
249 end if
250 end if
251 if (time % caltype == cal_cyclic) then
252 time % day = int( iday + imon * cyclic_mdays )
253 goto 999
254 endif
255 month = modulo(imon - 3, year_months) + 3
256 iyear = iyear + int( (imon - month) / year_months )
257 iday = iday + int( (month * 306 - 914) / 10 )
258 if (time % caltype == cal_noleap) then
259 time % day = iday + iyear * 365 + 90
260 else
261 iday = iday + int( (iyear * four_years - modulo(iyear * four_years, 4)) / 4 )
262 if (time % caltype == cal_julian .or. iday < 640116) then
263 time % day = iday + 91
264 else
265 century = (iyear - modulo(iyear, 100)) / 100 + 1
266 time % day = iday - int( (century * 3 - modulo(century * 3, 4)) / 4 ) + 93
267 endif
268 endif
269
270
271999 continue
272 call storeerror(stat, subname, err, cause_c, cause_i)
273 esday = time % day ; essec = time % sec ; esds = time % day_seconds
274 call endsub(subname, 'time (caltype=%d, day=%d, sec=%f, zone=%c, day_seconds=%f)', &
275 & i=(/time % caltype, esday/), d=(/essec, esds/), &
276 & c1=trim(time % zone))
277
278 contains
279 subroutine get_current_time(jyear, jmon, jday, jsec, jzone)
280 !
281 ! date_and_time 組み込みサブルーチンを用いて, 現在
282 ! 時刻と UTC からの時差を返します.
283 !
284 use dc_types, only: dp
285 use dc_string, only: stod
286 implicit none
287 integer, intent(out) :: jyear, jmon, jday
288 real(DP), intent(out) :: jsec
289 character(*), intent(out) :: jzone
290
291 integer :: date_time_values(1:8)
292 character(5) :: zone_raw
293 continue
294
295 call date_and_time(zone=zone_raw, values=date_time_values)
296
297 jzone = zone_raw(1:3) // ":" // zone_raw(4:5)
298
299 jyear = date_time_values(1)
300 jmon = date_time_values(2)
301 jday = date_time_values(3)
302 jsec = real(date_time_values(5), dp) * hour_seconds &
303 & + real(date_time_values(6), dp) * min_seconds &
304 & + real(date_time_values(7), dp)
305
306 end subroutine get_current_time
307
308end subroutine dcdatetimecreate1
309
310
311subroutine dcdifftimecreate1(diff, &
312 & year, mon, day, hour, min, sec, day_seconds, nondim, &
313 & sclyear, sclmon, sclday, sclsec )
314 !
315 ! dc_date_types#DC_DIFFTIME 型変数の生成を行います.
316 ! 引数 year, mon, day, hour, min, sec, nondim を与えない場合,
317 ! 0 が与えられたことになります.
318 !
319 ! 引数 *day_seconds* には 1 日何秒かを設定します. この引数を
320 ! 指定しない場合, dc_date_types#day_seconds の値が用いられます.
321 ! dc_date_types#day_seconds は SetSecOfDay で変更可能です.
322 !
325 use dc_date_types, only: dc_difftime, &
326 & day_seconds_default => day_seconds, &
328 use dc_message, only: messagenotify
329 use dc_trace, only: beginsub, endsub, debug
330 use dc_present, only: present_select
331 use dc_scaledsec, only: dc_scaled_sec, &
332 & assignment(=), dcscaledsecputline, &
333 & operator(==), operator(>), operator(<), operator(>=), operator(<=), &
334 & operator(+), operator(-), operator(*), operator(/), mod, modulo, &
335 & abs, int, sign, floor
336 use dc_string, only: cprintf
337 use dc_types, only: dp, string
338 implicit none
339 type(dc_difftime), intent(out) :: diff
340 integer, intent(in), optional:: year ! 年. Year
341 integer, intent(in), optional:: mon ! 月. Month
342 integer, intent(in), optional:: day ! 日. Day
343 integer, intent(in), optional:: hour ! 時. Hour
344 integer, intent(in), optional:: min ! 分. Minute
345 real(DP), intent(in), optional:: sec ! 秒. Second
346 real(DP), intent(in), optional:: day_seconds ! 1 日の秒数
347 real(DP), intent(in), optional:: nondim ! 無次元時間. Nondimensional time
348 type(dc_scaled_sec), intent(in), optional:: sclyear ! 年 (DC_SCALED_SEC 型)
349 type(dc_scaled_sec), intent(in), optional:: sclmon ! 月 (DC_SCALED_SEC 型)
350 type(dc_scaled_sec), intent(in), optional:: sclday ! 日 (DC_SCALED_SEC 型)
351 type(dc_scaled_sec), intent(in), optional:: sclsec ! 秒 (DC_SCALED_SEC 型)
352
353 type(dc_scaled_sec):: iyear, imon, iday, ihour, imin, isec
354 integer, parameter:: year_default = 0, mon_default = 0
355 integer, parameter:: day_default = 0, hour_default = 0, min_default = 0
356 integer, parameter:: sec_default = 0
357 real(DP):: essec, esds
358 integer :: esmon, esday
359 character(STRING):: endsub_msb
360 logical:: dbg_mode
361 character(*), parameter :: subname = 'DCDiffTimeCreate1'
362continue
363 call beginsub(subname)
364
365 if ( present(nondim) ) then
366 diff % nondim_flag = .true.
367 diff % mon = 0
368 diff % day = 0
369 diff % sec = nondim
370 goto 999
371 else
372 diff % nondim_flag = .false.
373 end if
374
375 if ( present(sclyear) ) then
376 iyear = sclyear
377 elseif( present(year) ) then
378 iyear = year
379 else
380 iyear = year_default
381 end if
382
383 if ( present(sclmon) ) then
384 imon = sclmon
385 elseif( present(mon) ) then
386 imon = mon
387 else
388 imon = mon_default
389 end if
390
391 if ( present(sclday) ) then
392 iday = sclday
393 elseif( present(day) ) then
394 iday = day
395 else
396 iday = day_default
397 end if
398
399 ihour = present_select(.false., hour_default, hour)
400 imin = present_select(.false., min_default, min)
401
402 if ( present(sclsec) ) then
403 isec = sclsec
404 elseif( present(sec) ) then
405 isec = sec
406 else
407 isec = sec_default
408 end if
409
410 diff % mon = iyear * year_months + imon
411 diff % day = iday
412 diff % sec = ihour * hour_seconds &
413 & + imin * min_seconds &
414 & + isec
415
416 if( present(day_seconds) ) then
417 diff % day_seconds = day_seconds
418 else
419 diff % day_seconds = day_seconds_default
420 end if
421
422 call dcdate_normalize(diff % day, diff % sec, diff % day_seconds, diff % nondim_flag)
423
424999 continue
425 call debug( dbg_mode )
426 if ( dbg_mode ) then
427 esmon = diff % mon ; esday = diff % day
428 essec = diff % sec ; esds = diff % day_seconds
429 endsub_msb = &
430 & cprintf( 'mon=%d, day=%d, sec=%f, day_seconds=%f, nondim_flag=%b', &
431 & i = (/ esmon, esday /), d = (/ essec, esds /), &
432 & l = (/ diff % nondim_flag /) )
433 else
434 endsub_msb = ''
435 end if
436 call endsub(subname, 'diff (%c)', c1 = trim(endsub_msb) )
437end subroutine dcdifftimecreate1
438
439
440subroutine dcdifftimecreate2d(diff, value, unit, unit_symbol, err)
441 !
442 ! dc_date_types#DC_DIFFTIME 型変数の生成を行います.
443 ! 引数 *value* に数値を, *unit* に単位を表す文字列を,
444 ! または *unit_symbol* に単位を表すシンボルを与えてください.
445 !
446 ! unit に指定できるのは以下の文字列です. (大文字小文字は区別しません).
447 !
448 ! 年 :: dc_date_types#UNIT_YEAR
449 ! 月 :: dc_date_types#UNIT_MONTH
450 ! 日 :: dc_date_types#UNIT_DAY
451 ! 時 :: dc_date_types#UNIT_HOUR
452 ! 分 :: dc_date_types#UNIT_MIN
453 ! 秒 :: dc_date_types#UNIT_SEC
454 ! 無次元時間 :: dc_date_types#UNIT_NONDIM
455 !
456 ! これらに該当しない文字列を *unit* に与えた場合, エラーを発生させます.
457 !
458 ! unit_symbol に指定できるのは以下のシンボルです.
459 !
460 ! 年 :: dc_date_types#UNIT_SYMBOL_YEAR
461 ! 月 :: dc_date_types#UNIT_SYMBOL_MONTH
462 ! 日 :: dc_date_types#UNIT_SYMBOL_DAY
463 ! 時 :: dc_date_types#UNIT_SYMBOL_HOUR
464 ! 分 :: dc_date_types#UNIT_SYMBOL_MIN
465 ! 秒 :: dc_date_types#UNIT_SYMBOL_SEC
466 ! 無次元時間 :: dc_date_types#UNIT_SYMBOL_NONDIM
467 !
468 ! これらに該当しないシンボルを *unit_symbol* に与えた場合,
469 ! エラーを発生させます.
470 !
471 ! 引数 *err* を与えている場合には *err* に .true. が返り,
472 ! プログラムは続行します.
473 !
474 use dc_types, only: dp, string
475 use dc_trace, only: beginsub, endsub
477 use dc_string, only: strieq
479 use dc_date_types, only: dc_difftime, &
482 & unit_symbol_err, &
484 use dc_scaledsec, only: dc_scaled_sec, &
485 & assignment(=), dcscaledsecputline, &
486 & operator(==), operator(>), operator(<), operator(>=), operator(<=), &
487 & operator(+), operator(-), operator(*), operator(/), mod, modulo, &
488 & abs, int, sign, floor
489 implicit none
490 type(dc_difftime), intent(out) :: diff
491 real(DP), intent(in) :: value
492 character(*), intent(in) :: unit
493 integer, intent(in), optional :: unit_symbol
494 logical, intent(out), optional :: err
495
496 real(DP):: essec
497 integer :: esmon, esday
498 integer :: stat, val_int
499 type(dc_scaled_sec):: val_scl, val_dec
500 character(STRING) :: cause_c
501 integer:: symbol
502
503 character(*), parameter :: subname = 'DCDiffTimeCreate2'
504continue
505 call beginsub(subname, 'value=%f', d=(/value/))
506 stat = dc_noerr
507 cause_c = ''
508 symbol = unit_symbol_err
509 if ( present(unit_symbol) ) then
510 symbol = unit_symbol
511 else
512 symbol = parsetimeunits(unit)
513 end if
514
515 if ( symbol == unit_symbol_sec ) then
516 call dcdifftimecreate(diff, sec=value)
517 goto 999
518 elseif ( symbol == unit_symbol_nondim ) then
519 call dcdifftimecreate(diff, nondim=value)
520 goto 999
521 end if
522
523 val_int = int(value)
524 val_scl = int(value)
525 val_dec = value - int(value)
526
527 if ( symbol == unit_symbol_min ) then
528 call dcdifftimecreate(diff, min = val_int, sclsec = val_dec * min_seconds)
529 elseif ( symbol == unit_symbol_hour ) then
530 call dcdifftimecreate(diff, hour = val_int, sclsec = val_dec * hour_seconds)
531 elseif ( symbol == unit_symbol_day ) then
532 call dcdifftimecreate(diff, sclday = val_scl, sclsec = val_dec * day_seconds)
533 elseif ( symbol == unit_symbol_month ) then
534 call dcdifftimecreate(diff, sclmon = val_scl, &
535 & sclsec = int(val_dec * cyclic_mdays) * day_seconds)
536 elseif ( symbol == unit_symbol_year ) then
537 call dcdifftimecreate(diff, sclyear = val_scl, &
538 & sclsec = int(val_dec * cyclic_mdays * year_months) * day_seconds)
539 else
540 stat = dc_ebadunit
541 cause_c = unit
542 end if
543
544999 continue
545 call storeerror(stat, subname, err, cause_c)
546 esmon = diff % mon ; esday = diff % day ; essec = diff % sec
547 call endsub(subname, 'diff (mon=%d, day=%d, sec=%f)', &
548 & i=(/esmon, esday/), d=(/essec/))
549end subroutine dcdifftimecreate2d
550
551subroutine dcdifftimecreate2r(diff, value, unit, unit_symbol, err)
552 use dc_types, only: dp
554 use dc_date_types, only: dc_difftime
555 implicit none
556 type(dc_difftime), intent(out) :: diff
557 real, intent(in) :: value
558 character(*), intent(in) :: unit
559 integer, intent(in), optional :: unit_symbol
560 logical, intent(out), optional :: err
561continue
562 call dcdifftimecreate(diff, real( value, dp ), unit, unit_symbol, err)
563end subroutine dcdifftimecreate2r
564
565subroutine dcdifftimecreate2i(diff, value, unit, unit_symbol, err)
566 use dc_types, only: dp
568 use dc_date_types, only: dc_difftime
569 implicit none
570 type(dc_difftime), intent(out) :: diff
571 integer, intent(in) :: value
572 character(*), intent(in) :: unit
573 integer, intent(in), optional :: unit_symbol
574 logical, intent(out), optional :: err
575continue
576 call dcdifftimecreate(diff, real( value, dp ), unit, unit_symbol, err)
577end subroutine dcdifftimecreate2i
578
579subroutine dcdatetimecreatei(time, sec)
580 !
581 ! dc_date_types#DC_DATETIME 型変数の生成を行います.
582 ! 引数 sec には秒数を与えてください. 年月日, 時分を使って
583 ! 指定を行いたい場合は Create を利用してください.
584 !
585 use dc_types, only: dp
586 use dc_date_types, only: dc_datetime
588 use dc_scaledsec, only: dc_scaled_sec, assignment(=)
589 implicit none
590 type(dc_datetime), intent(out):: time
591 integer, intent(in):: sec
592continue
593 call dcdatetimecreate(time, sec = real(sec, dp) )
594end subroutine dcdatetimecreatei
595
596subroutine dcdatetimecreater(time, sec)
597 !
598 ! dc_date_types#DC_DATETIME 型変数の生成を行います.
599 ! 引数 sec には秒数を与えてください. 年月日, 時分を使って
600 ! 指定を行いたい場合は Create を利用してください.
601 !
602 use dc_types, only: dp
603 use dc_date_types, only: dc_datetime
605 use dc_scaledsec, only: dc_scaled_sec, assignment(=)
606 implicit none
607 type(dc_datetime), intent(out):: time
608 real, intent(in):: sec
609continue
610 call dcdatetimecreate(time, sec = real(sec, dp) )
611end subroutine dcdatetimecreater
612
613subroutine dcdatetimecreated(time, sec)
614 use dc_types, only: dp
615 use dc_date_types, only: dc_datetime
617 use dc_scaledsec, only: dc_scaled_sec, assignment(=)
618 implicit none
619 type(dc_datetime), intent(out):: time
620 real(DP), intent(in):: sec
621continue
622 call dcdatetimecreate(time, sec = sec)
623end subroutine dcdatetimecreated
624
625subroutine dcdifftimecreatei(diff, sec)
626 !
627 ! dc_date_types#DC_DIFFTIME 型変数の生成を行います.
628 ! 引数 sec には秒数を与えてください. 年月日, 時分を使って
629 ! 指定を行いたい場合は Create を利用してください.
630 !
631 use dc_types, only: dp
632 use dc_date_types, only: dc_difftime
634 use dc_scaledsec, only: dc_scaled_sec, assignment(=)
635 implicit none
636 type(dc_difftime), intent(out):: diff
637 integer, intent(in):: sec
638continue
639 call dcdifftimecreate(diff, sec = real(sec, dp) )
640end subroutine dcdifftimecreatei
641
642subroutine dcdifftimecreater(diff, sec)
643 !
644 ! dc_date_types#DC_DIFFTIME 型変数の生成を行います.
645 ! 引数 sec には秒数を与えてください. 年月日, 時分を使って
646 ! 指定を行いたい場合は Create を利用してください.
647 !
648 use dc_types, only: dp
649 use dc_date_types, only: dc_difftime
651 use dc_scaledsec, only: dc_scaled_sec, assignment(=)
652 implicit none
653 type(dc_difftime), intent(out):: diff
654 real, intent(in):: sec
655continue
656 call dcdifftimecreate(diff, sec = real(sec, dp) )
657end subroutine dcdifftimecreater
658
659subroutine dcdifftimecreated(diff, sec)
660 use dc_types, only: dp
661 use dc_date_types, only: dc_difftime
663 use dc_scaledsec, only: dc_scaled_sec, assignment(=)
664 implicit none
665 type(dc_difftime), intent(out):: diff
666 real(DP), intent(in):: sec
667continue
668 call dcdifftimecreate(diff, sec = sec)
669end subroutine dcdifftimecreated
670
671
672!-----------------------------------------------
673! 後方互換用
674! For backward compatibility
675subroutine dcdatetimecreate1_bc(time, &
676 & year, mon, day, hour, min, sec, &
677 & zone, caltype, day_seconds, err)
678 use dc_types, only: dp
679 use dc_date_types, only: dc_datetime
681 type(dc_datetime), intent(out):: time
682 integer, intent(in), optional:: year, mon, day, hour, min
683 real(DP),intent(in), optional:: sec, day_seconds
684 character(*), intent(in), optional :: zone
685 integer, intent(in), optional:: caltype
686 logical, intent(out), optional:: err
687continue
688 call dcdatetimecreate( time, &
689 & year, mon, day, hour, min, sec, &
690 & zone, caltype, day_seconds = day_seconds, err = err )
691end subroutine dcdatetimecreate1_bc
692
693subroutine dcdifftimecreate1_bc(diff, &
694 & year, mon, day, hour, min, sec, day_seconds)
695 use dc_types, only: dp
696 use dc_date_types, only: dc_difftime
698 type(dc_difftime), intent(out) :: diff
699 integer, intent(in), optional:: year, mon, day, hour, min
700 real(DP),intent(in), optional:: sec, day_seconds
701continue
702 call dcdifftimecreate( diff, &
703 & year, mon, day, hour, min, sec, day_seconds )
704end subroutine dcdifftimecreate1_bc
705
706subroutine dcdifftimecreate2_bc(diff, value, unit, err)
707 use dc_types, only: dp
708 use dc_date_types, only: dc_difftime
710 type(dc_difftime), intent(out) :: diff
711 real(DP), intent(in) :: value
712 character(*), intent(in) :: unit
713 logical, intent(out), optional :: err
714continue
715 call dcdifftimecreate( diff, value, unit, err = err )
716end subroutine dcdifftimecreate2_bc
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)
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
real(dp), parameter, public cyclic_mdays
integer, parameter, public hour_seconds
integer, parameter, public unit_symbol_month
integer, parameter, public four_years
integer, parameter, public cal_cyclic
real(dp), save, public day_seconds
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
logical, save, public flag_set_day_seconds_scl
integer, parameter, public year_months
integer, parameter, public cal_gregorian
integer, parameter, public min_seconds
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)
Definition dc_error.f90:830
integer, parameter, public dc_ebadunit
Definition dc_error.f90:559
integer, parameter, public dc_noerr
Definition dc_error.f90:509
integer, parameter, public dc_ebadcaltype
Definition dc_error.f90:560
integer, parameter, public dc_ebadtimezone
Definition dc_error.f90:561
subroutine, public dcscaledsecputline(sclsec, unit, indent)
Provides kind type parameter values.
Definition dc_types.f90:49
integer, parameter, public token
Character length for word, token
Definition dc_types.f90:109
integer, parameter, public string
Character length for string
Definition dc_types.f90:118
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:83