13 integer (c_int) :: idoy
14 integer (c_int) :: idaysinmonth
15 integer (c_int) :: idaysinyear
16 integer (c_int) :: iyearofsimulation = 1
17 logical (c_bool) :: lisleapyear
18 integer (c_int) :: inumdaysfromorigin = 0
19 integer (c_int) :: idayofsimulation = 0
52 type (DATETIME_T),
intent(inout) :: start_date
53 type (DATETIME_T),
intent(inout) :: end_date
55 this%start = start_date
57 this%curr = start_date
66 type (DATETIME_T),
intent(in) :: new_current_date
68 if (( new_current_date > this%end ) .or. ( new_current_date < this%start )) &
69 stop(
"Attempted to set current date to one outside of start and end date." )
71 this%curr = new_current_date
72 this%iNumDaysFromOrigin = this%days_from_origin( new_current_date )
73 this%iDaysInMonth = this%curr%dayspermonth()
74 this%iDaysInYear = this%curr%daysperyear()
75 this%lIsLeapYear = this%curr%isLeapYear()
77 this%iDayOfSimulation = this%curr - this%start + 1
90 call this%curr%calcJulianDay()
92 this%iDaysInMonth = this%curr%dayspermonth()
93 this%iDaysInYear = this%curr%daysperyear()
94 this%lIsLeapYear = this%curr%isLeapYear()
96 this%iYearOfSimulation = this%curr%iYear - this%start%iYear + 1
97 this%iNumDaysFromOrigin = this%iNumDaysFromOrigin + 1
98 this%iDayOfSimulation = this%curr - this%start + 1
108 call this%curr%advanceLastDayOfMonth()
113 this%iDOY =
day_of_year( this%curr%getJulianDay() )
114 this%iYearOfSimulation = this%curr%iYear - this%start%iYear + 1
115 this%iNumDaysFromOrigin = this%iNumDaysFromOrigin + 1
116 this%iDayOfSimulation = this%curr - this%start + 1
126 real (c_double) :: num_days_from_origin
128 num_days_from_origin = real(
datetime - this%start, c_double)
135 real (c_float) :: percent_complete
137 percent_complete = real(this%curr - this%start) / real( this%end - this%start ) * 100.
147 call this%curr%addDay()
149 this%iDaysInMonth = this%curr%dayspermonth()
150 this%iDaysInYear = this%curr%daysperyear()
151 this%lIsLeapYear = this%curr%isLeapYear()
152 this%iDOY =
day_of_year( this%curr%getJulianDay() )
153 this%iYearOfSimulation = this%curr%iYear - this%start%iYear + 1
154 this%iNumDaysFromOrigin = this%iNumDaysFromOrigin + 1
155 this%iDayOfSimulation = this%curr - this%start + 1
This module contains the DATETIME_T class and associated time and date-related routines,...
integer(c_int) function, public day_of_year(ijd)
subroutine advance_curr_to_last_day_of_month_sub(this)
real(c_float) function percent_complete_fn(this)
type(date_range_t), public sim_dt
subroutine increment_by_one_day_sub(this)
subroutine advance_curr_to_last_day_of_year_sub(this)
subroutine set_curr_to_arbitrary_date_sub(this, new_current_date)
subroutine initialize_datetimes_sub(this, start_date, end_date)
real(c_double) function days_from_origin_fn(this, datetime)