SUEWS API Site
Documentation of SUEWS source code
Data Types | Functions/Subroutines
mod_timedelta Module Reference

Data Types

interface  timedelta
 

Functions/Subroutines

pure elemental type(timedelta) function timedelta_constructor (days, hours, minutes, seconds, milliseconds)
 
pure elemental integer function getdays (self)
 
pure elemental integer function gethours (self)
 
pure elemental integer function getminutes (self)
 
pure elemental integer function getseconds (self)
 
pure elemental integer function getmilliseconds (self)
 
pure elemental real(kind=real64) function total_seconds (self)
 
pure elemental type(timedelta) function timedelta_plus_timedelta (t0, t1)
 
pure elemental type(timedelta) function timedelta_minus_timedelta (t0, t1)
 
pure elemental type(timedelta) function unary_minus_timedelta (t0)
 
pure elemental logical function eq (td0, td1)
 
pure elemental logical function neq (td0, td1)
 
pure elemental logical function gt (td0, td1)
 
pure elemental logical function ge (td0, td1)
 
pure elemental logical function lt (td0, td1)
 
pure elemental logical function le (td0, td1)
 

Function/Subroutine Documentation

◆ eq()

pure elemental logical function mod_timedelta::eq ( class(timedelta), intent(in) td0,
type(timedelta), intent(in) td1 )
private

Definition at line 358 of file suews_util_datetime.f95.

359
360 !! `timedelta` object comparison operator. Returns `.true.` if `td0`
361 !! is equal to `td1` and `.false.` otherwise. Overloads the operator
362 !! `==`.
363
364 CLASS(timedelta), INTENT(in) :: td0 !! lhs `timedelta` instance
365 TYPE(timedelta), INTENT(in) :: td1 !! rhs `timedelta` instance
366
367 eq = td0%total_seconds() == td1%total_seconds()
368

References eq().

Referenced by eq(), mod_datetime::datetime::operator(), and mod_timedelta::timedelta::operator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ge()

pure elemental logical function mod_timedelta::ge ( class(timedelta), intent(in) td0,
type(timedelta), intent(in) td1 )
private

Definition at line 397 of file suews_util_datetime.f95.

398
399 !! `timedelta` object comparison operator. Returns `.true.` if `td0`
400 !! is greater than or equal to `td1` and `.false.` otherwise.
401 !! Overloads the operator >=.
402
403 CLASS(timedelta), INTENT(in) :: td0 !! lhs `timedelta` instance
404 TYPE(timedelta), INTENT(in) :: td1 !! rhs `timedelta` instance
405
406 ge = td0%total_seconds() >= td1%total_seconds()
407

References ge().

Referenced by ge(), mod_datetime::datetime::operator(), and mod_timedelta::timedelta::operator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getdays()

pure elemental integer function mod_timedelta::getdays ( class(timedelta), intent(in) self)
private

Definition at line 267 of file suews_util_datetime.f95.

268 !! Returns the number of days.
269 CLASS(timedelta), INTENT(in) :: self !! `timedelta` instance
270 getdays = self%days

References getdays().

Referenced by getdays().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gethours()

pure elemental integer function mod_timedelta::gethours ( class(timedelta), intent(in) self)
private

Definition at line 273 of file suews_util_datetime.f95.

274 !! Returns the number of hours.
275 CLASS(timedelta), INTENT(in) :: self !! `timedelta` instance
276 gethours = self%hours

References gethours().

Referenced by gethours().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getmilliseconds()

pure elemental integer function mod_timedelta::getmilliseconds ( class(timedelta), intent(in) self)
private

Definition at line 291 of file suews_util_datetime.f95.

292 !! Returns the number of milliseconds.
293 CLASS(timedelta), INTENT(in) :: self !! `timedelta` instance
294 getmilliseconds = self%milliseconds

References getmilliseconds().

Referenced by getmilliseconds().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getminutes()

pure elemental integer function mod_timedelta::getminutes ( class(timedelta), intent(in) self)
private

Definition at line 279 of file suews_util_datetime.f95.

280 !! Returns the number of minutes.
281 CLASS(timedelta), INTENT(in) :: self !! `timedelta` instance
282 getminutes = self%minutes

References getminutes().

Referenced by getminutes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getseconds()

pure elemental integer function mod_timedelta::getseconds ( class(timedelta), intent(in) self)
private

Definition at line 285 of file suews_util_datetime.f95.

286 !! Returns the number of seconds.
287 CLASS(timedelta), INTENT(in) :: self !! `timedelta` instance
288 getseconds = self%seconds

References getseconds().

Referenced by getseconds().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gt()

pure elemental logical function mod_timedelta::gt ( class(timedelta), intent(in) td0,
type(timedelta), intent(in) td1 )
private

Definition at line 384 of file suews_util_datetime.f95.

385
386 !! `timedelta` object comparison operator. Returns `.true.` if
387 !! `td0` is greater than `td1` and `.false.` otherwise. Overloads the
388 !! operator `>`.
389
390 CLASS(timedelta), INTENT(in) :: td0 !! lhs `timedelta` instance
391 TYPE(timedelta), INTENT(in) :: td1 !! rhs `timedelta` instance
392
393 gt = td0%total_seconds() > td1%total_seconds()
394

References gt().

Referenced by gt(), mod_datetime::datetime::operator(), and mod_timedelta::timedelta::operator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ le()

pure elemental logical function mod_timedelta::le ( class(timedelta), intent(in) td0,
type(timedelta), intent(in) td1 )
private

Definition at line 423 of file suews_util_datetime.f95.

424
425 !! `timedelta` object comparison operator. Returns `.true.` if `td0`
426 !! is less than or equal to `td1` and `.false.` otherwise. Overloads
427 !! the operator `<=`.
428
429 CLASS(timedelta), INTENT(in) :: td0 !! lhs `timedelta` instance
430 TYPE(timedelta), INTENT(in) :: td1 !! rhs `timedelta` instance
431
432 le = td0%total_seconds() <= td1%total_seconds()
433

References le().

Referenced by le(), mod_datetime::datetime::operator(), and mod_timedelta::timedelta::operator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lt()

pure elemental logical function mod_timedelta::lt ( class(timedelta), intent(in) td0,
type(timedelta), intent(in) td1 )
private

Definition at line 410 of file suews_util_datetime.f95.

411
412 !! `timedelta` object comparison operator. Returns `.true.` if `td0`
413 !! is less than `td1` and `.false.` otherwise. Overloads the operator
414 !! `<`.
415
416 CLASS(timedelta), INTENT(in) :: td0 !! lhs `timedelta` instance
417 TYPE(timedelta), INTENT(in) :: td1 !! rhs `timedelta` instance
418
419 lt = td0%total_seconds() < td1%total_seconds()
420

References lt().

Referenced by lt(), mod_datetime::datetime::operator(), and mod_timedelta::timedelta::operator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ neq()

pure elemental logical function mod_timedelta::neq ( class(timedelta), intent(in) td0,
type(timedelta), intent(in) td1 )
private

Definition at line 371 of file suews_util_datetime.f95.

372
373 !! `timedelta` object comparison operator. Returns `.true.` if `td0`
374 !! is not equal to `td1` and `.false.` otherwise. Overloads the
375 !! operator `/=`.
376
377 CLASS(timedelta), INTENT(in) :: td0 !! lhs `timedelta` instance
378 TYPE(timedelta), INTENT(in) :: td1 !! rhs `timedelta` instance
379
380 neq = .NOT. (td0%total_seconds() == td1%total_seconds())
381

References neq().

Referenced by neq(), mod_datetime::datetime::operator(), and mod_timedelta::timedelta::operator().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ timedelta_constructor()

pure elemental type(timedelta) function mod_timedelta::timedelta_constructor ( integer, intent(in), optional days,
integer, intent(in), optional hours,
integer, intent(in), optional minutes,
integer, intent(in), optional seconds,
integer, intent(in), optional milliseconds )
private

Definition at line 221 of file suews_util_datetime.f95.

223
224 !! Constructor function for the `timedelta` class.
225
226 INTEGER, INTENT(in), OPTIONAL :: days !! number of days
227 INTEGER, INTENT(in), OPTIONAL :: hours !! number of hours
228 INTEGER, INTENT(in), OPTIONAL :: minutes !! number of minutes
229 INTEGER, INTENT(in), OPTIONAL :: seconds !! number of seconds
230 INTEGER, INTENT(in), OPTIONAL :: milliseconds !! number of milliseconds
231
232 IF (PRESENT(days)) THEN
233 timedelta_constructor%days = days
234 ELSE
235 timedelta_constructor%days = 0
236 END IF
237
238 IF (PRESENT(hours)) THEN
239 timedelta_constructor%hours = hours
240 ELSE
241 timedelta_constructor%hours = 0
242 END IF
243
244 IF (PRESENT(minutes)) THEN
245 timedelta_constructor%minutes = minutes
246 ELSE
247 timedelta_constructor%minutes = 0
248 END IF
249
250 IF (PRESENT(seconds)) THEN
251 timedelta_constructor%seconds = seconds
252 ELSE
253 timedelta_constructor%seconds = 0
254 END IF
255
256 IF (PRESENT(milliseconds)) THEN
257 timedelta_constructor%milliseconds = milliseconds
258 ELSE
259 timedelta_constructor%milliseconds = 0
260 END IF
261

Referenced by mod_timedelta::timedelta::operator(), and mod_timedelta::timedelta::timedelta_constructor().

Here is the caller graph for this function:

◆ timedelta_minus_timedelta()

pure elemental type(timedelta) function mod_timedelta::timedelta_minus_timedelta ( class(timedelta), intent(in) t0,
type(timedelta), intent(in) t1 )
private

Definition at line 329 of file suews_util_datetime.f95.

330
331 !! Subtracts a `timedelta` instance from another. Returns a
332 !! `timedelta` instance. Overloads the operator `-`.
333
334 CLASS(timedelta), INTENT(in) :: t0 !! lhs `timedelta` instance
335 TYPE(timedelta), INTENT(in) :: t1 !! lhs `timedelta` instance
336 TYPE(timedelta) :: t !! result
337
338 t = t0 + (-t1)
339

Referenced by mod_timedelta::timedelta::operator().

Here is the caller graph for this function:

◆ timedelta_plus_timedelta()

pure elemental type(timedelta) function mod_timedelta::timedelta_plus_timedelta ( class(timedelta), intent(in) t0,
type(timedelta), intent(in) t1 )
private

Definition at line 312 of file suews_util_datetime.f95.

313
314 !! Adds two `timedelta` instances together and returns a `timedelta`
315 !! instance. Overloads the operator `+`.
316
317 CLASS(timedelta), INTENT(in) :: t0 !! lhs `timedelta` instance
318 TYPE(timedelta), INTENT(in) :: t1 !! rhs `timedelta` instance
319 TYPE(timedelta) :: t !! result
320
321 t = timedelta(days=t0%days + t1%days, &
322 hours=t0%hours + t1%hours, &
323 minutes=t0%minutes + t1%minutes, &
324 seconds=t0%seconds + t1%seconds, &
325 milliseconds=t0%milliseconds + t1%milliseconds)
326

Referenced by mod_timedelta::timedelta::operator().

Here is the caller graph for this function:

◆ total_seconds()

pure elemental real(kind=real64) function mod_timedelta::total_seconds ( class(timedelta), intent(in) self)
private

Definition at line 297 of file suews_util_datetime.f95.

298
299 !! Returns a total number of seconds contained in a `timedelta`
300 !! instance.
301
302 CLASS(timedelta), INTENT(in) :: self !! `timedelta` instance
303
304 total_seconds = self%days*86400._real64 &
305 + self%hours*3600._real64 &
306 + self%minutes*60._real64 &
307 + self%seconds &
308 + self%milliseconds*1e-3_real64
309

References total_seconds().

Referenced by total_seconds().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unary_minus_timedelta()

pure elemental type(timedelta) function mod_timedelta::unary_minus_timedelta ( class(timedelta), intent(in) t0)
private

Definition at line 342 of file suews_util_datetime.f95.

343
344 !! Takes a negative of a `timedelta` instance. Overloads the operator
345 !! `-`.
346
347 CLASS(timedelta), INTENT(in) :: t0 !! `timedelta` instance
348 TYPE(timedelta) :: t !! result
349
350 t%days = -t0%days
351 t%hours = -t0%hours
352 t%minutes = -t0%minutes
353 t%seconds = -t0%seconds
354 t%milliseconds = -t0%milliseconds
355

Referenced by mod_timedelta::timedelta::operator().

Here is the caller graph for this function: