Public Instance methods
TimeNow( [fmt] ) result(result)
Function : |
|
result : | character(STRING)
|
fmt : | character(*), intent(in), optional
|
現在時刻を返す
現在時刻を文字型変数として返します。 デフォルトでは JIS X 0301 の完全表記
の文字列を返します。 (例: 2005-08-05T21:48:37+09:00)。
Alias for DCTimeNow
Private Instance methods
Subroutine : |
|
diff : | type(DC_DIFFTIME), intent(in)
|
year : | integer, intent(out), optional
|
mon : | integer, intent(out), optional
|
day : | integer, intent(out), optional
|
hour : | integer, intent(out), optional
|
min : | integer, intent(out), optional
|
sec : | integer, intent(out), optional
|
[Source]
subroutine DCDateDiffEval(diff, year, mon, day, hour, min, sec)
use dc_date_types, only: DC_DIFFTIME
type(DC_DIFFTIME), intent(in):: diff
integer, intent(out), optional:: year, mon, day, hour, min, sec
if (present(year)) then
year = diff%mon / 12
endif
if (present(mon)) then
mon = mod(diff%mon, 12)
endif
if (present(day)) then
day = diff%day
endif
if (present(hour)) then
hour = int(diff%sec / 3600.0)
endif
if (present(min)) then
min = int(mod(diff%sec, 3600.0_DP) / 60.0)
endif
if (present(sec)) then
sec = mod(diff%sec, 60.0_DP)
endif
end subroutine DCDateDiffEval
Function : |
|
result : | character(STRING)
|
fmt : | character(*), intent(in), optional
|
現在時刻を返す
現在時刻を文字型変数として返します。 デフォルトでは JIS X 0301 の完全表記
の文字列を返します。 (例: 2005-08-05T21:48:37+09:00)。
[Source]
function DCTimeNow(fmt) result(result)
!
!== 現在時刻を返す
!
! 現在時刻を文字型変数として返します。
! デフォルトでは JIS X 0301 の完全表記
! の文字列を返します。 (例: 2005-08-05T21:48:37+09:00)。
!
!
!
implicit none
character(*), intent(in), optional :: fmt
character(STRING) :: result
integer :: values(1:8)
character(5) :: zone
character(6) :: zone_fmt
character(4) :: year
character(2) :: month, day, hour, min, sec
continue
call date_and_time(zone=zone, values=values)
zone_fmt = zone(1:3) // ":" // zone(4:5)
write(year, "(i4.4)") values(1)
write(month, "(i2.2)") values(2)
write(day, "(i2.2)") values(3)
write(hour, "(i2.2)") values(5)
write(min, "(i2.2)") values(6)
write(sec, "(i2.2)") values(7)
if (present_and_not_empty(fmt)) then
result = CPrintf('%cT%c%c', c1= year // '-' // month // '-' // day, c2= hour // ':' // min // ':' // sec, c3= trim(zone_fmt) )
else
result = CPrintf('%cT%c%c', c1= year // '-' // month // '-' // day, c2= hour // ':' // min // ':' // sec, c3= trim(zone_fmt) )
end if
end function DCTimeNow
Eval( diff, [year], [mon], [day], [hour], [min], [sec] )
Subroutine : |
|
diff : | type(DC_DIFFTIME), intent(in)
|
year : | integer, intent(out), optional
|
mon : | integer, intent(out), optional
|
day : | integer, intent(out), optional
|
hour : | integer, intent(out), optional
|
min : | integer, intent(out), optional
|
sec : | integer, intent(out), optional
|
Alias for DCDateDiffEval
Function : |
|
result : | type(DC_DIFFTIME)
|
diff1 : | type(DC_DIFFTIME), intent(in)
|
diff2 : | type(DC_DIFFTIME), intent(in)
|
[Source]
type(DC_DIFFTIME) function dcdate_add_ff(diff1, diff2) result(result)
type(DC_DIFFTIME), intent(in):: diff1, diff2
result%mon = diff1%mon + diff2%mon
result%day = diff1%day + diff2%day
result%sec = diff1%sec + diff2%sec
call dcdate_normalize(result%day, result%sec)
end function dcdate_add_ff
Function : |
|
result : | type(DC_DATETIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
time : | type(DC_DATETIME), intent(in)
|
[Source]
type(DC_DATETIME) function dcdate_add_ft(diff, time) result(result)
type(DC_DIFFTIME), intent(in):: diff
type(DC_DATETIME), intent(in):: time
result = DateTime(diff%mon, time%day + diff%day, time%sec + diff%sec)
end function dcdate_add_ft
Function : |
|
result : | type(DC_DATETIME)
|
time : | type(DC_DATETIME), intent(in)
|
diff : | type(DC_DIFFTIME), intent(in)
|
[Source]
type(DC_DATETIME) function dcdate_add_tf(time, diff) result(result)
type(DC_DATETIME), intent(in):: time
type(DC_DIFFTIME), intent(in):: diff
result = DateTime(diff%mon, time%day + diff%day, time%sec + diff%sec)
end function dcdate_add_tf
Function : |
|
result : | type(DC_DIFFTIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
denominator : | real(DP), intent(in)
|
[Source]
type(DC_DIFFTIME) function dcdate_div_fd(diff, denominator) result(result)
use dc_date_types, only: CYCLIC_MDAYS, DAY_SECONDS
type(DC_DIFFTIME), intent(in):: diff
real(DP), intent(in):: denominator
real(DP):: month, day
month = diff%mon / denominator
result%mon = int(month)
day = diff%day / denominator + int(CYCLIC_MDAYS * (month - result%mon))
result%day = int(day)
result%sec = diff%sec / denominator + (day - result%day) * DAY_SECONDS
call dcdate_normalize(result%day, result%sec)
end function dcdate_div_fd
Function : |
|
result : | real(DP)
|
diff1 : | type(DC_DIFFTIME), intent(in)
|
diff2 : | type(DC_DIFFTIME), intent(in)
|
[Source]
real(DP) function dcdate_div_ff(diff1, diff2) result(result)
use dc_date_types, only: CYCLIC_MDAYS, DAY_SECONDS
type(DC_DIFFTIME), intent(in):: diff1, diff2
! ゼロ割対応コードが必要か?
result = (DAY_SECONDS * (CYCLIC_MDAYS * diff1%mon + diff1%day) + diff1%sec) / (DAY_SECONDS * (CYCLIC_MDAYS * diff2%mon + diff2%day) + diff2%sec)
end function dcdate_div_ff
Function : |
|
result : | type(DC_DIFFTIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
denominator : | integer, intent(in)
|
[Source]
type(DC_DIFFTIME) function dcdate_div_fi(diff, denominator) result(result)
use dc_date_types, only: CYCLIC_MDAYS, DAY_SECONDS
type(DC_DIFFTIME), intent(in):: diff
integer, intent(in):: denominator
continue
result%mon = diff%mon / denominator
! 月からの近似的繰り下がりは日単位でしか行わない
result%day = diff%day / denominator + int((CYCLIC_MDAYS * mod(diff%mon, denominator)) / denominator)
result%sec = diff%sec / denominator + (DAY_SECONDS * mod(diff%day, denominator)) / denominator
end function dcdate_div_fi
Function : |
|
result : | type(DC_DIFFTIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
denominator : | real, intent(in)
|
[Source]
type(DC_DIFFTIME) function dcdate_div_fr(diff, denominator) result(result)
use dc_date_types, only: CYCLIC_MDAYS, DAY_SECONDS
type(DC_DIFFTIME), intent(in):: diff
real, intent(in):: denominator
real(DP):: month, day
month = diff%mon / denominator
result%mon = int(month)
day = diff%day / denominator + int(CYCLIC_MDAYS * (month - result%mon))
result%day = int(day)
result%sec = diff%sec / denominator + (day - result%day) * DAY_SECONDS
call dcdate_normalize(result%day, result%sec)
end function dcdate_div_fr
Function : |
|
result : | type(DC_DIFFTIME)
|
diff1 : | type(DC_DIFFTIME), intent(in)
|
diff2 : | type(DC_DIFFTIME), intent(in)
|
[Source]
type(DC_DIFFTIME) function dcdate_mod_ff(diff1, diff2) result(result)
use dc_date_types, only: CYCLIC_MDAYS, DAY_SECONDS
type(DC_DIFFTIME), intent(in):: diff1, diff2
real(DP):: sec1, sec2
if (diff1%day == 0 .and. diff2%day == 0 .and. diff1%sec == 0.0 .and. diff2%sec == 0.0) then
result%mon = mod(diff1%mon, diff2%mon)
result%day = 0
result%sec = 0.0
else if (diff1%sec == 0.0 .and. diff2%sec == 0.0) then
result%mon = 0
result%day = mod((CYCLIC_MDAYS * diff1%mon + diff1%day), (CYCLIC_MDAYS * diff2%mon + diff2%day))
result%sec = 0.0
else
sec1 = DAY_SECONDS * (CYCLIC_MDAYS * diff1%mon + diff1%day) + diff1%sec
sec2 = DAY_SECONDS * (CYCLIC_MDAYS * diff2%mon + diff2%day) + diff2%sec
result%sec = mod(sec1, sec2)
result%day = 0.0
result%mon = 0.0
call dcdate_normalize(result%day, result%sec)
endif
end function dcdate_mod_ff
Function : |
|
result : | type(DC_DIFFTIME)
|
factor : | real(DP), intent(in)
|
diff : | type(DC_DIFFTIME), intent(in)
|
[Source]
type(DC_DIFFTIME) function dcdate_mul_df(factor, diff) result(result)
use dc_date_types, only: CYCLIC_MDAYS
real(DP), intent(in):: factor
type(DC_DIFFTIME), intent(in):: diff
result%mon = int(factor) * diff%mon
result%day = factor * diff%day + CYCLIC_MDAYS * mod(factor, 1.0_DP)
result%sec = factor * diff%sec
call dcdate_normalize(result%day, result%sec)
end function dcdate_mul_df
Function : |
|
result : | type(DC_DIFFTIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
factor : | real(DP), intent(in)
|
[Source]
type(DC_DIFFTIME) function dcdate_mul_fd(diff, factor) result(result)
use dc_date_types, only: CYCLIC_MDAYS, DAY_SECONDS
type(DC_DIFFTIME), intent(in):: diff
real(DP), intent(in):: factor
real(DP):: month, day
month = factor * diff%mon
result%mon = int(month)
day = factor * diff%day + int(CYCLIC_MDAYS * (month - result%mon))
result%day = int(day)
result%sec = factor * diff%sec + (day - result%day) * DAY_SECONDS
call dcdate_normalize(result%day, result%sec)
end function dcdate_mul_fd
Function : |
|
result : | type(DC_DIFFTIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
factor : | integer, intent(in)
|
[Source]
type(DC_DIFFTIME) function dcdate_mul_fi(diff, factor) result(result)
type(DC_DIFFTIME), intent(in):: diff
integer, intent(in):: factor
result%mon = factor * diff%mon
result%day = factor * diff%day
result%sec = factor * diff%sec
call dcdate_normalize(result%day, result%sec)
end function dcdate_mul_fi
Function : |
|
result : | type(DC_DIFFTIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
factor : | real, intent(in)
|
[Source]
type(DC_DIFFTIME) function dcdate_mul_fr(diff, factor) result(result)
use dc_date_types, only: CYCLIC_MDAYS, DAY_SECONDS
type(DC_DIFFTIME), intent(in):: diff
real, intent(in):: factor
real(DP):: month, day
month = factor * diff%mon
result%mon = int(month)
day = factor * diff%day + int(CYCLIC_MDAYS * (month - result%mon))
result%day = int(day)
result%sec = factor * diff%sec + (day - result%day) * DAY_SECONDS
call dcdate_normalize(result%day, result%sec)
end function dcdate_mul_fr
Function : |
|
result : | type(DC_DIFFTIME)
|
factor : | integer, intent(in)
|
diff : | type(DC_DIFFTIME), intent(in)
|
[Source]
type(DC_DIFFTIME) function dcdate_mul_if(factor, diff) result(result)
integer, intent(in):: factor
type(DC_DIFFTIME), intent(in):: diff
result%mon = factor * diff%mon
result%day = factor * diff%day
result%sec = factor * diff%sec
call dcdate_normalize(result%day, result%sec)
end function dcdate_mul_if
Function : |
|
result : | type(DC_DIFFTIME)
|
factor : | real, intent(in)
|
diff : | type(DC_DIFFTIME), intent(in)
|
[Source]
type(DC_DIFFTIME) function dcdate_mul_rf(factor, diff) result(result)
use dc_date_types, only: CYCLIC_MDAYS
real, intent(in):: factor
type(DC_DIFFTIME), intent(in):: diff
result%mon = int(factor) * diff%mon
result%day = factor * diff%day + CYCLIC_MDAYS * mod(factor, 1.0)
result%sec = factor * diff%sec
call dcdate_normalize(result%day, result%sec)
end function dcdate_mul_rf
Subroutine : |
|
day : | integer, intent(inout)
|
sec : | real(DP), intent(inout)
|
[Source]
subroutine dcdate_normalize(day, sec)
use dc_date_types, only: DAY_SECONDS
integer, intent(inout):: day
real(DP), intent(inout):: sec
integer:: sgn
if (abs(sec) > DAY_SECONDS) then
day = day + int(sec / DAY_SECONDS)
sec = modulo(sec, DAY_SECONDS)
end if
if ((sec > 0.0 .and. day < 0) .or. (sec < 0.0 .and. day > 0)) then
sgn = sign(day, 1)
day = day - sgn
sec = sec + sgn * DAY_SECONDS
endif
end subroutine dcdate_normalize
Function : |
|
result : | type(DC_DATETIME)
|
time : | type(DC_DATETIME), intent(in)
|
diff : | type(DC_DIFFTIME), intent(in)
|
[Source]
type(DC_DATETIME) function dcdate_sub_tf(time, diff) result(result)
type(DC_DATETIME), intent(in):: time
type(DC_DIFFTIME), intent(in):: diff
result = DateTime(-diff%mon, time%day - diff%day, time%sec - diff%sec)
end function dcdate_sub_tf
Function : |
|
result : | type(DC_DIFFTIME)
|
time1 : | type(DC_DATETIME), intent(in)
|
time2 : | type(DC_DATETIME), intent(in)
|
[Source]
type(DC_DIFFTIME) function dcdate_sub_tt(time1, time2) result(result)
type(DC_DATETIME), intent(in):: time1, time2
result%day = time1%day - time2%day
result%sec = time1%sec - time2%sec
call dcdate_normalize(result%day, result%sec)
end function dcdate_sub_tt
mod( diff1, diff2 ) result(result)
Function : |
|
result : | type(DC_DIFFTIME)
|
diff1 : | type(DC_DIFFTIME), intent(in)
|
diff2 : | type(DC_DIFFTIME), intent(in)
|
Alias for dcdate_mod_ff
operator(*)( diff, factor ) result(result)
Function : |
|
result : | type(DC_DIFFTIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
factor : | integer, intent(in)
|
Alias for dcdate_mul_fi
operator(*)( diff, factor ) result(result)
Function : |
|
result : | type(DC_DIFFTIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
factor : | real(DP), intent(in)
|
Alias for dcdate_mul_fd
operator(*)( diff, factor ) result(result)
Function : |
|
result : | type(DC_DIFFTIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
factor : | real, intent(in)
|
Alias for dcdate_mul_fr
operator(*)( factor, diff ) result(result)
Function : |
|
result : | type(DC_DIFFTIME)
|
factor : | integer, intent(in)
|
diff : | type(DC_DIFFTIME), intent(in)
|
Alias for dcdate_mul_if
operator(*)( factor, diff ) result(result)
Function : |
|
result : | type(DC_DIFFTIME)
|
factor : | real(DP), intent(in)
|
diff : | type(DC_DIFFTIME), intent(in)
|
Alias for dcdate_mul_df
operator(*)( factor, diff ) result(result)
Function : |
|
result : | type(DC_DIFFTIME)
|
factor : | real, intent(in)
|
diff : | type(DC_DIFFTIME), intent(in)
|
Alias for dcdate_mul_rf
operator(+)( diff, time ) result(result)
Function : |
|
result : | type(DC_DATETIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
time : | type(DC_DATETIME), intent(in)
|
Alias for dcdate_add_ft
operator(+)( diff1, diff2 ) result(result)
Function : |
|
result : | type(DC_DIFFTIME)
|
diff1 : | type(DC_DIFFTIME), intent(in)
|
diff2 : | type(DC_DIFFTIME), intent(in)
|
Alias for dcdate_add_ff
operator(+)( time, diff ) result(result)
Function : |
|
result : | type(DC_DATETIME)
|
time : | type(DC_DATETIME), intent(in)
|
diff : | type(DC_DIFFTIME), intent(in)
|
Alias for dcdate_add_tf
operator(-)( time, diff ) result(result)
Function : |
|
result : | type(DC_DATETIME)
|
time : | type(DC_DATETIME), intent(in)
|
diff : | type(DC_DIFFTIME), intent(in)
|
Alias for dcdate_sub_tf
operator(-)( time1, time2 ) result(result)
Function : |
|
result : | type(DC_DIFFTIME)
|
time1 : | type(DC_DATETIME), intent(in)
|
time2 : | type(DC_DATETIME), intent(in)
|
Alias for dcdate_sub_tt
operator(/)( diff, denominator ) result(result)
Function : |
|
result : | type(DC_DIFFTIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
denominator : | integer, intent(in)
|
Alias for dcdate_div_fi
operator(/)( diff, denominator ) result(result)
Function : |
|
result : | type(DC_DIFFTIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
denominator : | real(DP), intent(in)
|
Alias for dcdate_div_fd
operator(/)( diff, denominator ) result(result)
Function : |
|
result : | type(DC_DIFFTIME)
|
diff : | type(DC_DIFFTIME), intent(in)
|
denominator : | real, intent(in)
|
Alias for dcdate_div_fr
operator(/)( diff1, diff2 ) result(result)
Function : |
|
result : | real(DP)
|
diff1 : | type(DC_DIFFTIME), intent(in)
|
diff2 : | type(DC_DIFFTIME), intent(in)
|
Alias for dcdate_div_ff