0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_datetime Module Reference

Types to deal with datetimes. More...

Data Types

module  datetime
 This is a container to hold a date-time. More...
 
module  puredate
 This is a container to hold only a date. More...
 
module  puretime
 This is a container to hold only a time. More...
 
module  timedelta
 This is a container to hold a defined time span. More...
 

Functions/Subroutines

pure type(timedelta) function, public zero_delta ()
 zero time delta
 
pure type(timedelta) function, public one_week ()
 one week time delta
 
pure type(timedelta) function, public one_day ()
 one day time delta
 
pure type(timedelta) function, public one_hour ()
 one hour time delta
 
pure type(timedelta) function, public one_minute ()
 one minute time delta
 
pure type(timedelta) function, public one_second ()
 one second time delta
 
pure type(puretime) function, public midnight ()
 midnight (00:00)
 
pure type(puretime) function, public midday ()
 midday (12:00)
 
pure type(puretime) function, public day_hour (hour)
 time for given hour
 
type(datetime) function, public now ()
 get current datetime
 
type(puredate) function, public today ()
 get todays puredate
 
type(puretime) function, public currently ()
 get current puretime
 
pure integer(i4) function weekday (year, month, day)
 day of the week
 
pure logical function, public is_leap_year (year)
 whether a given year is a leap year
 
pure integer(i4) function, public days_in_month (year, month)
 number of days in a given month
 
pure integer(i4) function, public days_in_year (year)
 number of days in a given year
 
pure integer(i4) function days_before_year (year)
 number of days before a given year since year 1
 
pure subroutine doy_to_month_day (year, doy, month, day)
 get date from day of the year
 
subroutine check_year (year)
 check if a given year is valid
 
subroutine check_month (month)
 check if a given month is valid
 
subroutine check_day (year, month, day)
 check if a given day is valid
 
subroutine check_hour (hour)
 check if a given hour is valid
 
subroutine check_minute (minute)
 check if a given minute is valid
 
subroutine check_second (second)
 check if a given second is valid
 
subroutine check_datetime (year, month, day, hour, minute, second)
 check if a datetime is valid
 
type(datetime) function dt_init (year, month, day, hour, minute, second)
 initialize a datetime
 
type(datetime) function dt_from_string (string)
 datetime from string
 
type(datetime) function dt_from_cf (string, value)
 datetime from cf-string and value
 
pure type(datetime) function dt_from_date_time (in_date, in_time)
 datetime from date and time
 
pure type(datetime) function dt_from_julian (julian, calendar)
 datetime from fractional julian day
 
type(datetime) function dt_replace (this, year, month, day, hour, minute, second)
 new datetime with specified fields
 
pure subroutine dt_copy_dt (this, that)
 copy a datetime
 
pure subroutine dt_copy_d (this, that)
 copy a datetime from a date
 
pure type(puredate) function get_date (this)
 date of the datetime
 
pure type(puretime) function get_time (this)
 time of the datetime
 
pure character(19) function dt_str (this)
 string representation of the datetime
 
pure real(dp) function dt_julian (this, calendar)
 datetime as fractional julian day
 
pure integer(i4) function dt_weekday (this)
 day of the week
 
pure integer(i4) function dt_doy (this)
 day of the year
 
pure logical function is_new_year (this)
 datetime is a new year
 
pure logical function is_new_month (this)
 datetime is a new month
 
pure logical function is_new_week (this)
 datetime is a new week
 
pure logical function is_new_day (this)
 datetime is a new day
 
pure logical function is_new_hour (this)
 datetime is a new hour
 
pure logical function is_new_minute (this)
 datetime is a new month
 
pure logical function dt_eq (this, that)
 equal comparison of datetimes
 
pure logical function dt_eq_d (this, that)
 equal comparison of datetime and date
 
pure logical function dt_neq (this, that)
 not equal comparison of datetimes
 
pure logical function dt_neq_d (this, that)
 not equal comparison of datetime and date
 
pure logical function dt_lt (this, that)
 less than comparison of datetimes
 
pure logical function dt_lt_d (this, that)
 less than comparison of datetime and date
 
pure logical function dt_gt (this, that)
 greater than comparison of datetimes
 
pure logical function dt_gt_d (this, that)
 greater than comparison of datetime and date
 
pure logical function dt_leq (this, that)
 less than or equal comparison of datetimes
 
pure logical function dt_leq_d (this, that)
 less than or equal comparison of datetime and date
 
pure logical function dt_geq (this, that)
 greater than or equal comparison of datetimes
 
pure logical function dt_geq_d (this, that)
 less than or equal comparison of datetime and date
 
pure type(datetime) function dt_add_td (this, that)
 add a timedelta to a datetime
 
pure type(datetime) function td_add_dt (that, this)
 add a timedelta to a datetime
 
pure type(datetime) function dt_sub_td (this, that)
 subtract a timedelta from a datetime
 
pure type(timedelta) function dt_sub_dt (this, that)
 difference between two datetimes
 
pure type(timedelta) function dt_sub_d (this, that)
 difference between datetime and date
 
type(puredate) function d_init (year, month, day)
 initialize a date
 
type(puredate) function d_from_string (string)
 date from string
 
pure type(puredate) function d_from_julian (julian, calendar)
 date from fractional julian day
 
type(puredate) function d_replace (this, year, month, day)
 new date with specified fields
 
pure type(datetime) function to_datetime (this)
 convert date to a datetime
 
pure integer(i4) function to_ordinal (this)
 convert date to number of days since year 1
 
pure character(10) function d_str (this)
 string representation of the date
 
pure real(dp) function d_julian (this, calendar)
 date as fractional julian day
 
pure integer(i4) function d_weekday (this)
 day of the week
 
pure integer(i4) function d_doy (this)
 day of the year
 
pure logical function d_is_new_year (this)
 date is a new year
 
pure logical function d_is_new_month (this)
 date is a new month
 
pure logical function d_is_new_week (this)
 date is a new week
 
pure logical function d_eq (this, that)
 equal comparison of dates
 
pure logical function d_eq_dt (this, that)
 equal comparison of date and datetime
 
pure logical function d_neq (this, that)
 not equal comparison of dates
 
pure logical function d_neq_dt (this, that)
 not equal comparison of date and datetime
 
pure logical function d_lt (this, that)
 less than comparison of dates
 
pure logical function d_lt_dt (this, that)
 less than comparison of date and datetime
 
pure logical function d_gt (this, that)
 greater than comparison of dates
 
pure logical function d_gt_dt (this, that)
 greater than comparison of date and datetime
 
pure logical function d_leq (this, that)
 less than or equal comparison of dates
 
pure logical function d_leq_dt (this, that)
 less than or equal comparison of date and datetime
 
pure logical function d_geq (this, that)
 greater than or equal comparison of dates
 
pure logical function d_geq_dt (this, that)
 greater than or equal comparison of date and datetime
 
pure type(puredate) function d_add_td (this, that)
 add a timedelta to a date
 
pure type(puredate) function td_add_d (that, this)
 add a timedelta to a date
 
pure type(puredate) function d_sub_td (this, that)
 subtract a timedelta from a date
 
pure type(timedelta) function d_sub_d (this, that)
 difference between two dates
 
pure type(timedelta) function d_sub_dt (this, that)
 difference between date and datetime
 
type(puretime) function t_init (hour, minute, second)
 initialize a time
 
type(puretime) function t_from_string (string)
 time from string
 
pure type(puretime) function t_from_day_second (day_second)
 time from day second
 
pure subroutine t_copy (this, that)
 copy a time
 
type(puretime) function t_replace (this, hour, minute, second)
 new time with specified fields
 
pure character(8) function t_str (this)
 string representation of the time
 
pure integer(i4) function t_day_second (this)
 time to second of the day
 
pure logical function t_is_new_day (this)
 time is a new day / midnight
 
pure logical function t_is_new_hour (this)
 time is a new hour
 
pure logical function t_is_new_minute (this)
 time is a new month
 
pure logical function t_eq (this, that)
 equal comparison of times
 
pure logical function t_neq (this, that)
 not equal comparison of times
 
pure logical function t_lt (this, that)
 less than comparison of times
 
pure logical function t_gt (this, that)
 greater than comparison of times
 
pure logical function t_leq (this, that)
 less than or equal comparison of times
 
pure logical function t_geq (this, that)
 greater than or equal comparison of times
 
pure type(puretime) function t_add_td (this, that)
 add a timedelta to a time
 
pure type(puretime) function td_add_t (that, this)
 add a timedelta to a time
 
pure type(puretime) function t_sub_td (this, that)
 subtract a timedelta from a time
 
pure type(timedelta) function t_sub_t (this, that)
 difference between two times
 
pure type(timedelta) function td_init (days, seconds, minutes, hours, weeks)
 initialize a timedelta
 
pure type(timedelta) function td_abs (this)
 absolute timedelta
 
pure integer(i8) function td_total_seconds (this)
 timedelta in seconds (may need i8)
 
pure type(timedelta) function from_total_seconds (total_seconds)
 
pure subroutine td_copy (this, that)
 copy a timedelta
 
pure logical function td_eq (this, that)
 equal comparison of timedeltas
 
pure logical function td_neq (this, that)
 not equal comparison of timedeltas
 
pure logical function td_lt (this, that)
 less than comparison of timedeltas
 
pure logical function td_gt (this, that)
 greater than comparison of timedeltas
 
pure logical function td_leq (this, that)
 less than or equal comparison of timedeltas
 
pure logical function td_geq (this, that)
 greater than or equal comparison of timedeltas
 
pure type(timedelta) function td_add (this, that)
 adding two timedeltas
 
pure type(timedelta) function td_sub (this, that)
 adding two timedeltas
 
pure type(timedelta) function td_neg (this)
 negative timedelta
 
pure type(timedelta) function td_pos (this)
 positive timedelta
 
pure type(timedelta) function td_mul1 (this, that)
 multiply a timedelta with an integer
 
pure type(timedelta) function td_mul2 (that, this)
 multiply a timedelta with an integer
 
pure type(timedelta) function td_mul1_dp (this, that)
 multiply a timedelta with a real
 
pure type(timedelta) function td_mul2_dp (that, this)
 multiply a timedelta with a real
 
pure type(timedelta) function td_div (this, that)
 divide a timedelta by an integer
 
pure type(timedelta) function td_div_dp (this, that)
 divide a timedelta by a real
 
pure real(dp) function td_div_td (this, that)
 divide a timedelta by a timedelta
 

Variables

integer(i4), parameter, public year_days = 365_i4
 days in standard year
 
integer(i4), parameter, public leap_year_days = 366_i4
 days in leap year
 
integer(i4), parameter, public year_months = 12_i4
 months in year
 
integer(i4), parameter, public week_days = 7_i4
 days in week
 
integer(i4), parameter, public day_hours = 24_i4
 hours in day
 
integer(i4), parameter, public clock_hours = 12_i4
 hours on a clock
 
integer(i4), parameter, public hour_minutes = 60_i4
 minutes in hour
 
integer(i4), parameter, public minute_seconds = 60_i4
 seconds in minute
 
integer(i4), parameter, public day_minutes = DAY_HOURS * HOUR_MINUTES
 minutes in day
 
integer(i4), parameter, public day_seconds = DAY_MINUTES * MINUTE_SECONDS
 seconds in day
 
integer(i4), parameter, public hour_seconds = HOUR_MINUTES * MINUTE_SECONDS
 seconds in hour
 
integer(i4), parameter, public week_hours = WEEK_DAYS * DAY_HOURS
 hours in week
 
integer(i4), parameter, public week_minutes = WEEK_DAYS * DAY_MINUTES
 minutes in week
 
integer(i4), parameter, public week_seconds = WEEK_DAYS * DAY_SECONDS
 seconds in week
 
integer(i4), parameter min_year = 1_i4
 minimum for year
 
integer(i4), parameter max_year = 9999_i4
 maximum for year
 

Detailed Description

Types to deal with datetimes.

This module provides four types to deal with date and time

  1. puredate : containing year, month and day
  2. puretime : containing hour, minute and second
  3. datetime : combination of date and time
  4. timedelta : difference between two datetimes (or dates) in days and (sub-day) seconds

These type can be used in arithmetic operations (+, -, *, /) and can be compared (<, >, <=, >=, ==, /=) where it makes sense.

The following example demonstrates the functionality:

program main
implicit none
type(datetime) :: date1, date2, date3, date4, date5
type(puredate) :: day1
type(puretime) :: time1
type(timedelta) :: delta1
! create dates add time-deltas
date1 = datetime(2000, 2, 28)
date2 = date1 + one_day()
print*, date2%str()
date3 = date1 + 2 * one_day()
print*, date3%str()
! substract half a day
delta1 = one_day() / 2
date4 = date3 - delta1
! compare dates/times
print*, "is midday: ", date4%time() == midday()
print*, "date4 after date2: ", date4 > date2
! create from date and time
date5 = datetime(date1%date(), date4%time())
print*, date5%str()
! create from datetime string
date5 = datetime("2023-05-08 12:32:30")
day1 = date("2023-05-08")
time1 = time("12:32:30")
print*, date5 == time1%with_date(day1)
print*, date5 == day1%with_time(time1)
print*, date5 == datetime(day1, time1)
! use cf-convention string and value
date5 = datetime("seconds since 1992-10-8 15:15:42", day_seconds - hour_seconds)
print*, date5%str()
end program main
Types to deal with datetimes.
pure type(puretime) function, public midday()
midday (12:00)
integer(i4), parameter, public day_seconds
seconds in day
pure type(timedelta) function, public one_day()
one day time delta
integer(i4), parameter, public hour_seconds
seconds in hour
This is a container to hold a date-time.
This is a container to hold only a date.
This is a container to hold only a time.
This is a container to hold a defined time span.

Several special constants are provided as well:

Provided convenience routines:

A date is assumed to be given in the gregorian calender. That means, there is a leap year (February has 29 days instead of 28) if:

  • year is divisible by 4
  • year is not divisible by 100 or it is divisible by 400
Note
Dates before 1582-10-15 should be used with caution. The gregorian calender replaced the julian calender and advanced the date by 10 days: Thursday 4 October 1582 was followed by Friday 15 October 1582. Using this module for erlier dates will assume the proleptic gregorian calendar.
Version
0.1
Authors
Sebastian Mueller
Date
May 2023

Function/Subroutine Documentation

◆ check_datetime()

subroutine mo_datetime::check_datetime ( integer(i4), intent(in), optional  year,
integer(i4), intent(in), optional  month,
integer(i4), intent(in), optional  day,
integer(i4), intent(in), optional  hour,
integer(i4), intent(in), optional  minute,
integer(i4), intent(in), optional  second 
)
private

check if a datetime is valid

Parameters
[in]year1 <= year <= 9999
[in]month1 <= month <= 12
[in]day1 <= day <= number of days in the given month and year
[in]hour0 <= hour < 24
[in]minute0 <= minute < 60
[in]second0 <= second < 60

Definition at line 587 of file mo_datetime.f90.

References check_day(), check_hour(), check_minute(), check_month(), check_second(), and check_year().

Referenced by d_init(), dt_init(), and t_init().

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

◆ check_day()

subroutine mo_datetime::check_day ( integer(i4), intent(in)  year,
integer(i4), intent(in)  month,
integer(i4), intent(in)  day 
)
private

check if a given day is valid

Parameters
[in]year1 <= year <= 9999
[in]month1 <= month <= 12
[in]day1 <= day <= number of days in the given month and year

Definition at line 553 of file mo_datetime.f90.

References days_in_month().

Referenced by check_datetime().

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

◆ check_hour()

subroutine mo_datetime::check_hour ( integer(i4), intent(in), optional  hour)
private

check if a given hour is valid

Parameters
[in]hour0 <= hour < 24

Definition at line 563 of file mo_datetime.f90.

References day_hours.

Referenced by check_datetime().

Here is the caller graph for this function:

◆ check_minute()

subroutine mo_datetime::check_minute ( integer(i4), intent(in), optional  minute)
private

check if a given minute is valid

Parameters
[in]minute0 <= minute < 60

Definition at line 571 of file mo_datetime.f90.

References hour_minutes.

Referenced by check_datetime().

Here is the caller graph for this function:

◆ check_month()

subroutine mo_datetime::check_month ( integer(i4), intent(in)  month)
private

check if a given month is valid

Parameters
[in]month1 <= month <= 12

Definition at line 545 of file mo_datetime.f90.

References year_months.

Referenced by check_datetime().

Here is the caller graph for this function:

◆ check_second()

subroutine mo_datetime::check_second ( integer(i4), intent(in), optional  second)
private

check if a given second is valid

Parameters
[in]second0 <= second < 60

Definition at line 579 of file mo_datetime.f90.

References minute_seconds.

Referenced by check_datetime().

Here is the caller graph for this function:

◆ check_year()

subroutine mo_datetime::check_year ( integer(i4), intent(in)  year)
private

check if a given year is valid

Parameters
[in]year1 <= year <= 9999

Definition at line 537 of file mo_datetime.f90.

References max_year, and min_year.

Referenced by check_datetime().

Here is the caller graph for this function:

◆ currently()

type(puretime) function, public mo_datetime::currently

get current puretime

Definition at line 445 of file mo_datetime.f90.

References currently(), and now().

Referenced by currently().

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

◆ d_add_td()

pure type(puredate) function mo_datetime::d_add_td ( class(puredate), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

add a timedelta to a date

Definition at line 1225 of file mo_datetime.f90.

References d_add_td(), days_in_year(), and doy_to_month_day().

Referenced by d_add_td(), mo_datetime::puredate::operator(), and td_add_d().

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

◆ d_doy()

pure integer(i4) function mo_datetime::d_doy ( class(puredate), intent(in)  this)
private

day of the year

Definition at line 1103 of file mo_datetime.f90.

References d_doy(), and days_in_month().

Referenced by d_doy(), and dt_doy().

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

◆ d_eq()

pure logical function mo_datetime::d_eq ( class(puredate), intent(in)  this,
class(puredate), intent(in)  that 
)
private

equal comparison of dates

Definition at line 1135 of file mo_datetime.f90.

References d_eq().

Referenced by d_eq(), d_geq(), d_leq(), d_neq(), and mo_datetime::puredate::operator().

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

◆ d_eq_dt()

pure logical function mo_datetime::d_eq_dt ( class(puredate), intent(in)  this,
class(datetime), intent(in)  that 
)
private

equal comparison of date and datetime

Definition at line 1142 of file mo_datetime.f90.

References d_eq_dt(), and dt_eq().

Referenced by d_eq_dt(), and mo_datetime::puredate::operator().

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

◆ d_from_julian()

pure type(puredate) function mo_datetime::d_from_julian ( real(dp), intent(in)  julian,
integer(i4), intent(in), optional  calendar 
)
private

date from fractional julian day

Parameters
[in]julianfractional julian day
[in]calendarThe calendar to use, the global calendar will be used by default

Definition at line 1039 of file mo_datetime.f90.

References d_from_julian().

Referenced by d_from_julian().

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

◆ d_from_string()

type(puredate) function mo_datetime::d_from_string ( character(*), intent(in)  string)
private

date from string

Definition at line 1026 of file mo_datetime.f90.

References d_from_string(), d_init(), and mo_string_utils::divide_string().

Referenced by d_from_string(), dt_from_cf(), and dt_from_string().

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

◆ d_geq()

pure logical function mo_datetime::d_geq ( class(puredate), intent(in)  this,
class(puredate), intent(in)  that 
)
private

greater than or equal comparison of dates

Definition at line 1210 of file mo_datetime.f90.

References d_eq(), d_geq(), and d_gt().

Referenced by d_geq(), and mo_datetime::puredate::operator().

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

◆ d_geq_dt()

pure logical function mo_datetime::d_geq_dt ( class(puredate), intent(in)  this,
class(datetime), intent(in)  that 
)
private

greater than or equal comparison of date and datetime

Definition at line 1217 of file mo_datetime.f90.

References d_geq_dt(), and dt_geq().

Referenced by d_geq_dt(), and mo_datetime::puredate::operator().

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

◆ d_gt()

pure logical function mo_datetime::d_gt ( class(puredate), intent(in)  this,
class(puredate), intent(in)  that 
)
private

greater than comparison of dates

Definition at line 1180 of file mo_datetime.f90.

References d_gt(), d_lt(), and d_neq().

Referenced by d_geq(), d_gt(), and mo_datetime::puredate::operator().

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

◆ d_gt_dt()

pure logical function mo_datetime::d_gt_dt ( class(puredate), intent(in)  this,
class(datetime), intent(in)  that 
)
private

greater than comparison of date and datetime

Definition at line 1187 of file mo_datetime.f90.

References d_gt_dt(), and dt_gt().

Referenced by d_gt_dt(), and mo_datetime::puredate::operator().

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

◆ d_init()

type(puredate) function mo_datetime::d_init ( integer(i4), intent(in), optional  year,
integer(i4), intent(in), optional  month,
integer(i4), intent(in), optional  day 
)
private

initialize a date

Parameters
[in]year1 (default) <= year <= 9999
[in]month1 (default) <= month <= 12
[in]day1 (default) <= day <= number of days for given month and year

Definition at line 1010 of file mo_datetime.f90.

References check_datetime().

Referenced by d_from_string(), and d_replace().

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

◆ d_is_new_month()

pure logical function mo_datetime::d_is_new_month ( class(puredate), intent(in)  this)
private

date is a new month

Definition at line 1121 of file mo_datetime.f90.

References d_is_new_month().

Referenced by d_is_new_month().

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

◆ d_is_new_week()

pure logical function mo_datetime::d_is_new_week ( class(puredate), intent(in)  this)
private

date is a new week

Definition at line 1128 of file mo_datetime.f90.

References d_is_new_week().

Referenced by d_is_new_week().

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

◆ d_is_new_year()

pure logical function mo_datetime::d_is_new_year ( class(puredate), intent(in)  this)
private

date is a new year

Definition at line 1114 of file mo_datetime.f90.

References d_is_new_year().

Referenced by d_is_new_year().

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

◆ d_julian()

pure real(dp) function mo_datetime::d_julian ( class(puredate), intent(in)  this,
integer(i4), intent(in), optional  calendar 
)
private

date as fractional julian day

Parameters
[in]calendarThe calendar to use, the global calendar will be used by default

Definition at line 1088 of file mo_datetime.f90.

References d_julian().

Referenced by d_julian().

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

◆ d_leq()

pure logical function mo_datetime::d_leq ( class(puredate), intent(in)  this,
class(puredate), intent(in)  that 
)
private

less than or equal comparison of dates

Definition at line 1195 of file mo_datetime.f90.

References d_eq(), d_leq(), and d_lt().

Referenced by d_leq(), and mo_datetime::puredate::operator().

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

◆ d_leq_dt()

pure logical function mo_datetime::d_leq_dt ( class(puredate), intent(in)  this,
class(datetime), intent(in)  that 
)
private

less than or equal comparison of date and datetime

Definition at line 1202 of file mo_datetime.f90.

References d_leq_dt(), and dt_leq().

Referenced by d_leq_dt(), and mo_datetime::puredate::operator().

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

◆ d_lt()

pure logical function mo_datetime::d_lt ( class(puredate), intent(in)  this,
class(puredate), intent(in)  that 
)
private

less than comparison of dates

Definition at line 1165 of file mo_datetime.f90.

References d_lt().

Referenced by d_gt(), d_leq(), d_lt(), and mo_datetime::puredate::operator().

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

◆ d_lt_dt()

pure logical function mo_datetime::d_lt_dt ( class(puredate), intent(in)  this,
class(datetime), intent(in)  that 
)
private

less than comparison of date and datetime

Definition at line 1172 of file mo_datetime.f90.

References d_lt_dt(), and dt_lt().

Referenced by d_lt_dt(), and mo_datetime::puredate::operator().

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

◆ d_neq()

pure logical function mo_datetime::d_neq ( class(puredate), intent(in)  this,
class(puredate), intent(in)  that 
)
private

not equal comparison of dates

Definition at line 1150 of file mo_datetime.f90.

References d_eq(), and d_neq().

Referenced by d_gt(), d_neq(), and mo_datetime::puredate::operator().

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

◆ d_neq_dt()

pure logical function mo_datetime::d_neq_dt ( class(puredate), intent(in)  this,
class(datetime), intent(in)  that 
)
private

not equal comparison of date and datetime

Definition at line 1157 of file mo_datetime.f90.

References d_neq_dt(), and dt_neq().

Referenced by d_neq_dt(), and mo_datetime::puredate::operator().

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

◆ d_replace()

type(puredate) function mo_datetime::d_replace ( class(puredate), intent(in)  this,
integer(i4), intent(in), optional  year,
integer(i4), intent(in), optional  month,
integer(i4), intent(in), optional  day 
)
private

new date with specified fields

Parameters
[in]year1 <= year <= 9999
[in]month1 <= month <= 12
[in]day1 <= day <= number of days in the given month and year

Definition at line 1050 of file mo_datetime.f90.

References d_init(), and d_replace().

Referenced by d_replace().

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

◆ d_str()

pure character(10) function mo_datetime::d_str ( class(puredate), intent(in)  this)
private

string representation of the date

Definition at line 1081 of file mo_datetime.f90.

References d_str().

Referenced by d_str(), and dt_str().

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

◆ d_sub_d()

pure type(timedelta) function mo_datetime::d_sub_d ( class(puredate), intent(in)  this,
class(puredate), intent(in)  that 
)
private

difference between two dates

Definition at line 1272 of file mo_datetime.f90.

References d_sub_d().

Referenced by d_sub_d(), and mo_datetime::puredate::operator().

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

◆ d_sub_dt()

pure type(timedelta) function mo_datetime::d_sub_dt ( class(puredate), intent(in)  this,
class(datetime), intent(in)  that 
)
private

difference between date and datetime

Definition at line 1280 of file mo_datetime.f90.

References d_sub_dt().

Referenced by d_sub_dt(), and mo_datetime::puredate::operator().

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

◆ d_sub_td()

pure type(puredate) function mo_datetime::d_sub_td ( class(puredate), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

subtract a timedelta from a date

Definition at line 1264 of file mo_datetime.f90.

References d_sub_td().

Referenced by d_sub_td(), and mo_datetime::puredate::operator().

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

◆ d_weekday()

pure integer(i4) function mo_datetime::d_weekday ( class(puredate), intent(in)  this)
private

day of the week

Definition at line 1096 of file mo_datetime.f90.

References d_weekday(), and weekday().

Referenced by d_weekday().

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

◆ day_hour()

pure type(puretime) function, public mo_datetime::day_hour ( integer(i4), intent(in)  hour)

time for given hour

Definition at line 421 of file mo_datetime.f90.

References day_hour(), and day_hours.

Referenced by day_hour().

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

◆ days_before_year()

pure integer(i4) function mo_datetime::days_before_year ( integer(i4), intent(in)  year)
private

number of days before a given year since year 1

Parameters
[in]year1 <= year <= 9999

Definition at line 509 of file mo_datetime.f90.

References days_before_year(), and year_days.

Referenced by days_before_year(), and to_ordinal().

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

◆ days_in_month()

pure integer(i4) function, public mo_datetime::days_in_month ( integer(i4), intent(in)  year,
integer(i4), intent(in)  month 
)

number of days in a given month

Parameters
[in]year1 <= year <= 9999
[in]month1 <= month <= 12

Definition at line 482 of file mo_datetime.f90.

References days_in_month(), and is_leap_year().

Referenced by check_day(), d_doy(), days_in_month(), and doy_to_month_day().

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

◆ days_in_year()

pure integer(i4) function, public mo_datetime::days_in_year ( integer(i4), intent(in)  year)

number of days in a given year

Parameters
[in]year1 <= year <= 9999

Definition at line 501 of file mo_datetime.f90.

References days_in_year(), is_leap_year(), leap_year_days, and year_days.

Referenced by d_add_td(), days_in_year(), doy_to_month_day(), and dt_sub_dt().

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

◆ doy_to_month_day()

pure subroutine mo_datetime::doy_to_month_day ( integer(i4), intent(in)  year,
integer(i4), intent(in)  doy,
integer(i4), intent(out), optional  month,
integer(i4), intent(out), optional  day 
)
private

get date from day of the year

Parameters
[in]year1 <= year <= 9999
[in]doy1 <= doy <= days_in_year (will be capped)
[out]monthmonth for the given doy
[out]dayday in month for the given doy

Definition at line 518 of file mo_datetime.f90.

References days_in_month(), days_in_year(), and year_months.

Referenced by d_add_td().

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

◆ dt_add_td()

pure type(datetime) function mo_datetime::dt_add_td ( class(datetime), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

add a timedelta to a datetime

Definition at line 945 of file mo_datetime.f90.

References dt_add_td(), dt_from_date_time(), t_from_day_second(), and td_init().

Referenced by dt_add_td(), mo_datetime::datetime::operator(), and td_add_dt().

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

◆ dt_copy_d()

pure subroutine mo_datetime::dt_copy_d ( class(datetime), intent(inout)  this,
class(puredate), intent(in)  that 
)
private

copy a datetime from a date

Definition at line 749 of file mo_datetime.f90.

Referenced by mo_datetime::datetime::assignment().

Here is the caller graph for this function:

◆ dt_copy_dt()

pure subroutine mo_datetime::dt_copy_dt ( class(datetime), intent(inout)  this,
class(datetime), intent(in)  that 
)
private

copy a datetime

Definition at line 736 of file mo_datetime.f90.

Referenced by mo_datetime::datetime::assignment().

Here is the caller graph for this function:

◆ dt_doy()

pure integer(i4) function mo_datetime::dt_doy ( class(datetime), intent(in)  this)
private

day of the year

Definition at line 802 of file mo_datetime.f90.

References d_doy(), and dt_doy().

Referenced by dt_doy().

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

◆ dt_eq()

pure logical function mo_datetime::dt_eq ( class(datetime), intent(in)  this,
class(datetime), intent(in)  that 
)
private

equal comparison of datetimes

Definition at line 851 of file mo_datetime.f90.

References dt_eq().

Referenced by d_eq_dt(), dt_eq(), dt_eq_d(), dt_geq(), dt_leq(), dt_neq(), and mo_datetime::datetime::operator().

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

◆ dt_eq_d()

pure logical function mo_datetime::dt_eq_d ( class(datetime), intent(in)  this,
class(puredate), intent(in)  that 
)
private

equal comparison of datetime and date

Definition at line 858 of file mo_datetime.f90.

References dt_eq(), and dt_eq_d().

Referenced by dt_eq_d(), dt_neq_d(), and mo_datetime::datetime::operator().

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

◆ dt_from_cf()

type(datetime) function mo_datetime::dt_from_cf ( character(*), intent(in)  string,
integer(i4), intent(in)  value 
)
private

datetime from cf-string and value

Definition at line 650 of file mo_datetime.f90.

References d_from_string(), mo_string_utils::divide_string(), dt_from_cf(), dt_from_date_time(), midnight(), t_from_string(), and td_init().

Referenced by dt_from_cf().

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

◆ dt_from_date_time()

pure type(datetime) function mo_datetime::dt_from_date_time ( class(puredate), intent(in)  in_date,
class(puretime), intent(in), optional  in_time 
)
private

datetime from date and time

Parameters
[in]in_datedate to use
[in]in_timetime to use (midnight by default)

Definition at line 679 of file mo_datetime.f90.

References midnight().

Referenced by dt_add_td(), dt_from_cf(), dt_from_string(), and to_datetime().

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

◆ dt_from_julian()

pure type(datetime) function mo_datetime::dt_from_julian ( real(dp), intent(in)  julian,
integer(i4), intent(in), optional  calendar 
)
private

datetime from fractional julian day

Parameters
[in]julianfractional julian day
[in]calendarThe calendar to use, the global calendar will be used by default

Definition at line 696 of file mo_datetime.f90.

References dt_from_julian().

Referenced by dt_from_julian().

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

◆ dt_from_string()

type(datetime) function mo_datetime::dt_from_string ( character(*), intent(in)  string)
private

datetime from string

Definition at line 636 of file mo_datetime.f90.

References d_from_string(), mo_string_utils::divide_string(), dt_from_date_time(), dt_from_string(), midnight(), and t_from_string().

Referenced by dt_from_string().

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

◆ dt_geq()

pure logical function mo_datetime::dt_geq ( class(datetime), intent(in)  this,
class(datetime), intent(in)  that 
)
private

greater than or equal comparison of datetimes

Definition at line 929 of file mo_datetime.f90.

References dt_eq(), dt_geq(), and dt_gt().

Referenced by d_geq_dt(), dt_geq(), dt_geq_d(), and mo_datetime::datetime::operator().

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

◆ dt_geq_d()

pure logical function mo_datetime::dt_geq_d ( class(datetime), intent(in)  this,
class(puredate), intent(in)  that 
)
private

less than or equal comparison of datetime and date

Definition at line 936 of file mo_datetime.f90.

References dt_geq(), and dt_geq_d().

Referenced by dt_geq_d(), and mo_datetime::datetime::operator().

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

◆ dt_gt()

pure logical function mo_datetime::dt_gt ( class(datetime), intent(in)  this,
class(datetime), intent(in)  that 
)
private

greater than comparison of datetimes

Definition at line 897 of file mo_datetime.f90.

References dt_gt(), dt_lt(), and dt_neq().

Referenced by d_gt_dt(), dt_geq(), dt_gt(), dt_gt_d(), and mo_datetime::datetime::operator().

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

◆ dt_gt_d()

pure logical function mo_datetime::dt_gt_d ( class(datetime), intent(in)  this,
class(puredate), intent(in)  that 
)
private

greater than comparison of datetime and date

Definition at line 904 of file mo_datetime.f90.

References dt_gt(), and dt_gt_d().

Referenced by dt_gt_d(), and mo_datetime::datetime::operator().

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

◆ dt_init()

type(datetime) function mo_datetime::dt_init ( integer(i4), intent(in), optional  year,
integer(i4), intent(in), optional  month,
integer(i4), intent(in), optional  day,
integer(i4), intent(in), optional  hour,
integer(i4), intent(in), optional  minute,
integer(i4), intent(in), optional  second 
)
private

initialize a datetime

Parameters
[in]year1 (default) <= year <= 9999
[in]month1 (default) <= month <= 12
[in]day1 (default) <= day <= number of days in the given month and year
[in]hour0 (default) <= hour < 24
[in]minute0 (default) <= minute < 60
[in]second0 (default) <= second < 60

Definition at line 610 of file mo_datetime.f90.

References check_datetime().

Referenced by dt_replace(), and now().

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

◆ dt_julian()

pure real(dp) function mo_datetime::dt_julian ( class(datetime), intent(in)  this,
integer(i4), intent(in), optional  calendar 
)
private

datetime as fractional julian day

Parameters
[in]calendarThe calendar to use, the global calendar will be used by default

Definition at line 787 of file mo_datetime.f90.

References dt_julian().

Referenced by dt_julian().

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

◆ dt_leq()

pure logical function mo_datetime::dt_leq ( class(datetime), intent(in)  this,
class(datetime), intent(in)  that 
)
private

less than or equal comparison of datetimes

Definition at line 913 of file mo_datetime.f90.

References dt_eq(), dt_leq(), and dt_lt().

Referenced by d_leq_dt(), dt_leq(), dt_leq_d(), and mo_datetime::datetime::operator().

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

◆ dt_leq_d()

pure logical function mo_datetime::dt_leq_d ( class(datetime), intent(in)  this,
class(puredate), intent(in)  that 
)
private

less than or equal comparison of datetime and date

Definition at line 920 of file mo_datetime.f90.

References dt_leq(), and dt_leq_d().

Referenced by dt_leq_d(), and mo_datetime::datetime::operator().

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

◆ dt_lt()

pure logical function mo_datetime::dt_lt ( class(datetime), intent(in)  this,
class(datetime), intent(in)  that 
)
private

less than comparison of datetimes

Definition at line 881 of file mo_datetime.f90.

References dt_lt().

Referenced by d_lt_dt(), dt_gt(), dt_leq(), dt_lt(), dt_lt_d(), and mo_datetime::datetime::operator().

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

◆ dt_lt_d()

pure logical function mo_datetime::dt_lt_d ( class(datetime), intent(in)  this,
class(puredate), intent(in)  that 
)
private

less than comparison of datetime and date

Definition at line 888 of file mo_datetime.f90.

References dt_lt(), and dt_lt_d().

Referenced by dt_lt_d(), and mo_datetime::datetime::operator().

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

◆ dt_neq()

pure logical function mo_datetime::dt_neq ( class(datetime), intent(in)  this,
class(datetime), intent(in)  that 
)
private

not equal comparison of datetimes

Definition at line 866 of file mo_datetime.f90.

References dt_eq(), and dt_neq().

Referenced by d_neq_dt(), dt_gt(), dt_neq(), and mo_datetime::datetime::operator().

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

◆ dt_neq_d()

pure logical function mo_datetime::dt_neq_d ( class(datetime), intent(in)  this,
class(puredate), intent(in)  that 
)
private

not equal comparison of datetime and date

Definition at line 873 of file mo_datetime.f90.

References dt_eq_d(), and dt_neq_d().

Referenced by dt_neq_d(), and mo_datetime::datetime::operator().

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

◆ dt_replace()

type(datetime) function mo_datetime::dt_replace ( class(datetime), intent(in)  this,
integer(i4), intent(in), optional  year,
integer(i4), intent(in), optional  month,
integer(i4), intent(in), optional  day,
integer(i4), intent(in), optional  hour,
integer(i4), intent(in), optional  minute,
integer(i4), intent(in), optional  second 
)
private

new datetime with specified fields

Parameters
[in]year1 <= year <= 9999
[in]month1 <= month <= 12
[in]day1 <= day <= number of days in the given month and year
[in]hour0 <= hour < 24
[in]minute0 <= minute < 60
[in]second0 <= second < 60

Definition at line 710 of file mo_datetime.f90.

References dt_init(), and dt_replace().

Referenced by dt_replace().

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

◆ dt_str()

pure character(19) function mo_datetime::dt_str ( class(datetime), intent(in)  this)
private

string representation of the datetime

Definition at line 780 of file mo_datetime.f90.

References d_str(), dt_str(), and t_str().

Referenced by dt_str().

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

◆ dt_sub_d()

pure type(timedelta) function mo_datetime::dt_sub_d ( class(datetime), intent(in)  this,
class(puredate), intent(in)  that 
)
private

difference between datetime and date

Definition at line 1000 of file mo_datetime.f90.

References dt_sub_d(), and dt_sub_dt().

Referenced by dt_sub_d(), and mo_datetime::datetime::operator().

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

◆ dt_sub_dt()

pure type(timedelta) function mo_datetime::dt_sub_dt ( class(datetime), intent(in)  this,
class(datetime), intent(in)  that 
)
private

difference between two datetimes

Definition at line 977 of file mo_datetime.f90.

References days_in_year(), and dt_sub_dt().

Referenced by dt_sub_d(), dt_sub_dt(), and mo_datetime::datetime::operator().

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

◆ dt_sub_td()

pure type(datetime) function mo_datetime::dt_sub_td ( class(datetime), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

subtract a timedelta from a datetime

Definition at line 969 of file mo_datetime.f90.

References dt_sub_td().

Referenced by dt_sub_td(), and mo_datetime::datetime::operator().

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

◆ dt_weekday()

pure integer(i4) function mo_datetime::dt_weekday ( class(datetime), intent(in)  this)
private

day of the week

Definition at line 795 of file mo_datetime.f90.

References dt_weekday(), and weekday().

Referenced by dt_weekday().

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

◆ from_total_seconds()

pure type(timedelta) function mo_datetime::from_total_seconds ( integer(i8), intent(in)  total_seconds)
private

Definition at line 1530 of file mo_datetime.f90.

◆ get_date()

pure type(puredate) function mo_datetime::get_date ( class(datetime), intent(in)  this)
private

date of the datetime

Definition at line 762 of file mo_datetime.f90.

References get_date().

Referenced by get_date().

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

◆ get_time()

pure type(puretime) function mo_datetime::get_time ( class(datetime), intent(in)  this)
private

time of the datetime

Definition at line 771 of file mo_datetime.f90.

References get_time().

Referenced by get_time().

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

◆ is_leap_year()

pure logical function, public mo_datetime::is_leap_year ( integer(i4), intent(in)  year)

whether a given year is a leap year

Parameters
[in]year1 <= year <= 9999

Definition at line 475 of file mo_datetime.f90.

References is_leap_year().

Referenced by days_in_month(), days_in_year(), and is_leap_year().

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

◆ is_new_day()

pure logical function mo_datetime::is_new_day ( class(datetime), intent(in)  this)
private

datetime is a new day

Definition at line 830 of file mo_datetime.f90.

References is_new_day().

Referenced by is_new_day().

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

◆ is_new_hour()

pure logical function mo_datetime::is_new_hour ( class(datetime), intent(in)  this)
private

datetime is a new hour

Definition at line 837 of file mo_datetime.f90.

References is_new_hour().

Referenced by is_new_hour().

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

◆ is_new_minute()

pure logical function mo_datetime::is_new_minute ( class(datetime), intent(in)  this)
private

datetime is a new month

Definition at line 844 of file mo_datetime.f90.

References is_new_minute().

Referenced by is_new_minute().

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

◆ is_new_month()

pure logical function mo_datetime::is_new_month ( class(datetime), intent(in)  this)
private

datetime is a new month

Definition at line 816 of file mo_datetime.f90.

References is_new_month().

Referenced by is_new_month().

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

◆ is_new_week()

pure logical function mo_datetime::is_new_week ( class(datetime), intent(in)  this)
private

datetime is a new week

Definition at line 823 of file mo_datetime.f90.

References is_new_week().

Referenced by is_new_week().

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

◆ is_new_year()

pure logical function mo_datetime::is_new_year ( class(datetime), intent(in)  this)
private

datetime is a new year

Definition at line 809 of file mo_datetime.f90.

References is_new_year().

Referenced by is_new_year().

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

◆ midday()

pure type(puretime) function, public mo_datetime::midday

midday (12:00)

Definition at line 414 of file mo_datetime.f90.

References clock_hours, and midday().

Referenced by midday().

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

◆ midnight()

pure type(puretime) function, public mo_datetime::midnight

midnight (00:00)

Definition at line 407 of file mo_datetime.f90.

References midnight().

Referenced by dt_from_cf(), dt_from_date_time(), dt_from_string(), and midnight().

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

◆ now()

type(datetime) function, public mo_datetime::now

get current datetime

Definition at line 431 of file mo_datetime.f90.

References dt_init(), and now().

Referenced by currently(), now(), and today().

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

◆ one_day()

pure type(timedelta) function, public mo_datetime::one_day

one day time delta

Definition at line 381 of file mo_datetime.f90.

References one_day().

Referenced by one_day().

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

◆ one_hour()

pure type(timedelta) function, public mo_datetime::one_hour

one hour time delta

Definition at line 387 of file mo_datetime.f90.

References hour_seconds, and one_hour().

Referenced by one_hour().

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

◆ one_minute()

pure type(timedelta) function, public mo_datetime::one_minute

one minute time delta

Definition at line 393 of file mo_datetime.f90.

References minute_seconds, and one_minute().

Referenced by one_minute().

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

◆ one_second()

pure type(timedelta) function, public mo_datetime::one_second

one second time delta

Definition at line 399 of file mo_datetime.f90.

References one_second().

Referenced by one_second().

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

◆ one_week()

pure type(timedelta) function, public mo_datetime::one_week

one week time delta

Definition at line 375 of file mo_datetime.f90.

References one_week(), and week_days.

Referenced by one_week().

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

◆ t_add_td()

pure type(puretime) function mo_datetime::t_add_td ( class(puretime), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

add a timedelta to a time

Definition at line 1437 of file mo_datetime.f90.

References day_seconds, t_add_td(), and t_from_day_second().

Referenced by mo_datetime::puretime::operator(), t_add_td(), and td_add_t().

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

◆ t_copy()

pure subroutine mo_datetime::t_copy ( class(puretime), intent(inout)  this,
class(puretime), intent(in)  that 
)
private

copy a time

Definition at line 1333 of file mo_datetime.f90.

Referenced by mo_datetime::puretime::assignment().

Here is the caller graph for this function:

◆ t_day_second()

pure integer(i4) function mo_datetime::t_day_second ( class(puretime), intent(in)  this)
private

time to second of the day

Definition at line 1367 of file mo_datetime.f90.

References hour_seconds, minute_seconds, and t_day_second().

Referenced by t_day_second().

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

◆ t_eq()

pure logical function mo_datetime::t_eq ( class(puretime), intent(in)  this,
class(puretime), intent(in)  that 
)
private

equal comparison of times

Definition at line 1395 of file mo_datetime.f90.

References t_eq().

Referenced by mo_datetime::puretime::operator(), t_eq(), and t_neq().

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

◆ t_from_day_second()

pure type(puretime) function mo_datetime::t_from_day_second ( integer(i4), intent(in)  day_second)
private

time from day second

Parameters
[in]day_secondsecond of the day (will be capped)

Definition at line 1319 of file mo_datetime.f90.

References day_seconds, hour_seconds, minute_seconds, and t_from_day_second().

Referenced by dt_add_td(), t_add_td(), and t_from_day_second().

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

◆ t_from_string()

type(puretime) function mo_datetime::t_from_string ( character(*), intent(in)  string)
private

time from string

Definition at line 1306 of file mo_datetime.f90.

References mo_string_utils::divide_string(), t_from_string(), and t_init().

Referenced by dt_from_cf(), dt_from_string(), and t_from_string().

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

◆ t_geq()

pure logical function mo_datetime::t_geq ( class(puretime), intent(in)  this,
class(puretime), intent(in)  that 
)
private

greater than or equal comparison of times

Definition at line 1430 of file mo_datetime.f90.

References t_geq().

Referenced by mo_datetime::puretime::operator(), and t_geq().

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

◆ t_gt()

pure logical function mo_datetime::t_gt ( class(puretime), intent(in)  this,
class(puretime), intent(in)  that 
)
private

greater than comparison of times

Definition at line 1416 of file mo_datetime.f90.

References t_gt().

Referenced by mo_datetime::puretime::operator(), and t_gt().

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

◆ t_init()

type(puretime) function mo_datetime::t_init ( integer(i4), intent(in)  hour,
integer(i4), intent(in)  minute,
integer(i4), intent(in), optional  second 
)
private

initialize a time

Parameters
[in]hour0 <= hour < 24
[in]minute0 <= minute < 60
[in]second0 (default) <= second < 60

Definition at line 1291 of file mo_datetime.f90.

References check_datetime().

Referenced by t_from_string(), and t_replace().

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

◆ t_is_new_day()

pure logical function mo_datetime::t_is_new_day ( class(puretime), intent(in)  this)
private

time is a new day / midnight

Definition at line 1374 of file mo_datetime.f90.

References t_is_new_day().

Referenced by t_is_new_day().

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

◆ t_is_new_hour()

pure logical function mo_datetime::t_is_new_hour ( class(puretime), intent(in)  this)
private

time is a new hour

Definition at line 1381 of file mo_datetime.f90.

References t_is_new_hour().

Referenced by t_is_new_hour().

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

◆ t_is_new_minute()

pure logical function mo_datetime::t_is_new_minute ( class(puretime), intent(in)  this)
private

time is a new month

Definition at line 1388 of file mo_datetime.f90.

References t_is_new_minute().

Referenced by t_is_new_minute().

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

◆ t_leq()

pure logical function mo_datetime::t_leq ( class(puretime), intent(in)  this,
class(puretime), intent(in)  that 
)
private

less than or equal comparison of times

Definition at line 1423 of file mo_datetime.f90.

References t_leq().

Referenced by mo_datetime::puretime::operator(), and t_leq().

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

◆ t_lt()

pure logical function mo_datetime::t_lt ( class(puretime), intent(in)  this,
class(puretime), intent(in)  that 
)
private

less than comparison of times

Definition at line 1409 of file mo_datetime.f90.

References t_lt().

Referenced by mo_datetime::puretime::operator(), and t_lt().

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

◆ t_neq()

pure logical function mo_datetime::t_neq ( class(puretime), intent(in)  this,
class(puretime), intent(in)  that 
)
private

not equal comparison of times

Definition at line 1402 of file mo_datetime.f90.

References t_eq(), and t_neq().

Referenced by mo_datetime::puretime::operator(), and t_neq().

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

◆ t_replace()

type(puretime) function mo_datetime::t_replace ( class(puretime), intent(in)  this,
integer(i4), intent(in), optional  hour,
integer(i4), intent(in), optional  minute,
integer(i4), intent(in), optional  second 
)
private

new time with specified fields

Parameters
[in]hour0 <= hour < 24
[in]minute0 <= minute < 60
[in]second0 <= second < 60

Definition at line 1343 of file mo_datetime.f90.

References t_init(), and t_replace().

Referenced by t_replace().

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

◆ t_str()

pure character(8) function mo_datetime::t_str ( class(puretime), intent(in)  this)
private

string representation of the time

Definition at line 1360 of file mo_datetime.f90.

References t_str().

Referenced by dt_str(), and t_str().

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

◆ t_sub_t()

pure type(timedelta) function mo_datetime::t_sub_t ( class(puretime), intent(in)  this,
class(puretime), intent(in)  that 
)
private

difference between two times

Definition at line 1462 of file mo_datetime.f90.

References t_sub_t().

Referenced by mo_datetime::puretime::operator(), and t_sub_t().

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

◆ t_sub_td()

pure type(puretime) function mo_datetime::t_sub_td ( class(puretime), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

subtract a timedelta from a time

Definition at line 1454 of file mo_datetime.f90.

References t_sub_td().

Referenced by mo_datetime::puretime::operator(), and t_sub_td().

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

◆ td_abs()

pure type(timedelta) function mo_datetime::td_abs ( class(timedelta), intent(in)  this)
private

absolute timedelta

Definition at line 1509 of file mo_datetime.f90.

References td_abs().

Referenced by td_abs().

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

◆ td_add()

pure type(timedelta) function mo_datetime::td_add ( class(timedelta), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

adding two timedeltas

Definition at line 1589 of file mo_datetime.f90.

References td_add().

Referenced by mo_datetime::timedelta::operator(), and td_add().

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

◆ td_add_d()

pure type(puredate) function mo_datetime::td_add_d ( class(timedelta), intent(in)  that,
class(puredate), intent(in)  this 
)
private

add a timedelta to a date

Definition at line 1256 of file mo_datetime.f90.

References d_add_td(), and td_add_d().

Referenced by mo_datetime::puredate::operator(), and td_add_d().

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

◆ td_add_dt()

pure type(datetime) function mo_datetime::td_add_dt ( class(timedelta), intent(in)  that,
class(datetime), intent(in)  this 
)
private

add a timedelta to a datetime

Definition at line 961 of file mo_datetime.f90.

References dt_add_td(), and td_add_dt().

Referenced by mo_datetime::datetime::operator(), and td_add_dt().

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

◆ td_add_t()

pure type(puretime) function mo_datetime::td_add_t ( class(timedelta), intent(in)  that,
class(puretime), intent(in)  this 
)
private

add a timedelta to a time

Definition at line 1446 of file mo_datetime.f90.

References t_add_td(), and td_add_t().

Referenced by mo_datetime::puretime::operator(), and td_add_t().

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

◆ td_copy()

pure subroutine mo_datetime::td_copy ( class(timedelta), intent(inout)  this,
class(timedelta), intent(in)  that 
)
private

copy a timedelta

Definition at line 1538 of file mo_datetime.f90.

Referenced by mo_datetime::timedelta::assignment().

Here is the caller graph for this function:

◆ td_div()

pure type(timedelta) function mo_datetime::td_div ( class(timedelta), intent(in)  this,
integer(i4), intent(in)  that 
)
private

divide a timedelta by an integer

Definition at line 1649 of file mo_datetime.f90.

References td_div().

Referenced by mo_datetime::timedelta::operator(), and td_div().

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

◆ td_div_dp()

pure type(timedelta) function mo_datetime::td_div_dp ( class(timedelta), intent(in)  this,
real(dp), intent(in)  that 
)
private

divide a timedelta by a real

Definition at line 1657 of file mo_datetime.f90.

References td_div_dp().

Referenced by mo_datetime::timedelta::operator(), and td_div_dp().

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

◆ td_div_td()

pure real(dp) function mo_datetime::td_div_td ( class(timedelta), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

divide a timedelta by a timedelta

Definition at line 1665 of file mo_datetime.f90.

References td_div_td().

Referenced by mo_datetime::timedelta::operator(), and td_div_td().

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

◆ td_eq()

pure logical function mo_datetime::td_eq ( class(timedelta), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

equal comparison of timedeltas

Definition at line 1547 of file mo_datetime.f90.

References td_eq().

Referenced by mo_datetime::timedelta::operator(), td_eq(), and td_neq().

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

◆ td_geq()

pure logical function mo_datetime::td_geq ( class(timedelta), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

greater than or equal comparison of timedeltas

Definition at line 1582 of file mo_datetime.f90.

References td_geq().

Referenced by mo_datetime::timedelta::operator(), and td_geq().

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

◆ td_gt()

pure logical function mo_datetime::td_gt ( class(timedelta), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

greater than comparison of timedeltas

Definition at line 1568 of file mo_datetime.f90.

References td_gt().

Referenced by mo_datetime::timedelta::operator(), and td_gt().

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

◆ td_init()

pure type(timedelta) function mo_datetime::td_init ( integer(i4), intent(in), optional  days,
integer(i4), intent(in), optional  seconds,
integer(i4), intent(in), optional  minutes,
integer(i4), intent(in), optional  hours,
integer(i4), intent(in), optional  weeks 
)
private

initialize a timedelta

Parameters
[in]daysdays defining time-span
[in]secondsseconds defining time-span
[in]minutesminutes defining time-span
[in]hourshours defining time-span
[in]weeksweeks defining time-span

Definition at line 1472 of file mo_datetime.f90.

References day_seconds, hour_seconds, minute_seconds, and week_days.

Referenced by dt_add_td(), and dt_from_cf().

Here is the caller graph for this function:

◆ td_leq()

pure logical function mo_datetime::td_leq ( class(timedelta), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

less than or equal comparison of timedeltas

Definition at line 1575 of file mo_datetime.f90.

References td_leq().

Referenced by mo_datetime::timedelta::operator(), and td_leq().

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

◆ td_lt()

pure logical function mo_datetime::td_lt ( class(timedelta), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

less than comparison of timedeltas

Definition at line 1561 of file mo_datetime.f90.

References td_lt().

Referenced by mo_datetime::timedelta::operator(), and td_lt().

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

◆ td_mul1()

pure type(timedelta) function mo_datetime::td_mul1 ( class(timedelta), intent(in)  this,
integer(i4), intent(in)  that 
)
private

multiply a timedelta with an integer

Definition at line 1617 of file mo_datetime.f90.

References td_mul1().

Referenced by mo_datetime::timedelta::operator(), td_mul1(), and td_mul2().

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

◆ td_mul1_dp()

pure type(timedelta) function mo_datetime::td_mul1_dp ( class(timedelta), intent(in)  this,
real(dp), intent(in)  that 
)
private

multiply a timedelta with a real

Definition at line 1633 of file mo_datetime.f90.

References td_mul1_dp().

Referenced by mo_datetime::timedelta::operator(), td_mul1_dp(), and td_mul2_dp().

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

◆ td_mul2()

pure type(timedelta) function mo_datetime::td_mul2 ( integer(i4), intent(in)  that,
class(timedelta), intent(in)  this 
)
private

multiply a timedelta with an integer

Definition at line 1625 of file mo_datetime.f90.

References td_mul1(), and td_mul2().

Referenced by mo_datetime::timedelta::operator(), and td_mul2().

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

◆ td_mul2_dp()

pure type(timedelta) function mo_datetime::td_mul2_dp ( real(dp), intent(in)  that,
class(timedelta), intent(in)  this 
)
private

multiply a timedelta with a real

Definition at line 1641 of file mo_datetime.f90.

References td_mul1_dp(), and td_mul2_dp().

Referenced by mo_datetime::timedelta::operator(), and td_mul2_dp().

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

◆ td_neg()

pure type(timedelta) function mo_datetime::td_neg ( class(timedelta), intent(in)  this)
private

negative timedelta

Definition at line 1603 of file mo_datetime.f90.

References td_neg().

Referenced by mo_datetime::timedelta::operator(), and td_neg().

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

◆ td_neq()

pure logical function mo_datetime::td_neq ( class(timedelta), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

not equal comparison of timedeltas

Definition at line 1554 of file mo_datetime.f90.

References td_eq(), and td_neq().

Referenced by mo_datetime::timedelta::operator(), and td_neq().

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

◆ td_pos()

pure type(timedelta) function mo_datetime::td_pos ( class(timedelta), intent(in)  this)
private

positive timedelta

Definition at line 1610 of file mo_datetime.f90.

References td_pos().

Referenced by mo_datetime::timedelta::operator(), and td_pos().

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

◆ td_sub()

pure type(timedelta) function mo_datetime::td_sub ( class(timedelta), intent(in)  this,
class(timedelta), intent(in)  that 
)
private

adding two timedeltas

Definition at line 1596 of file mo_datetime.f90.

References td_sub().

Referenced by mo_datetime::timedelta::operator(), and td_sub().

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

◆ td_total_seconds()

pure integer(i8) function mo_datetime::td_total_seconds ( class(timedelta), intent(in)  this)
private

timedelta in seconds (may need i8)

Definition at line 1524 of file mo_datetime.f90.

References day_seconds, and td_total_seconds().

Referenced by td_total_seconds().

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

◆ to_datetime()

pure type(datetime) function mo_datetime::to_datetime ( class(puredate), intent(in)  this)
private

convert date to a datetime

Definition at line 1067 of file mo_datetime.f90.

References dt_from_date_time(), and to_datetime().

Referenced by to_datetime().

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

◆ to_ordinal()

pure integer(i4) function mo_datetime::to_ordinal ( class(puredate), intent(in)  this)
private

convert date to number of days since year 1

Definition at line 1074 of file mo_datetime.f90.

References days_before_year(), and to_ordinal().

Referenced by to_ordinal().

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

◆ today()

type(puredate) function, public mo_datetime::today

get todays puredate

Definition at line 438 of file mo_datetime.f90.

References now(), and today().

Referenced by today().

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

◆ weekday()

pure integer(i4) function mo_datetime::weekday ( integer(i4), intent(in)  year,
integer(i4), intent(in)  month,
integer(i4), intent(in)  day 
)
private

day of the week

Parameters
[in]year1 <= year <= 9999
[in]month1 <= month <= 12
[in]day1 <= day <= number of days in the given month and year

Definition at line 452 of file mo_datetime.f90.

References week_days, weekday(), and year_months.

Referenced by d_weekday(), dt_weekday(), and weekday().

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

◆ zero_delta()

pure type(timedelta) function, public mo_datetime::zero_delta

zero time delta

Definition at line 369 of file mo_datetime.f90.

References zero_delta().

Referenced by zero_delta().

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

Variable Documentation

◆ clock_hours

integer(i4), parameter, public mo_datetime::clock_hours = 12_i4

hours on a clock

Definition at line 140 of file mo_datetime.f90.

Referenced by midday().

◆ day_hours

integer(i4), parameter, public mo_datetime::day_hours = 24_i4

hours in day

Definition at line 139 of file mo_datetime.f90.

Referenced by check_hour(), and day_hour().

◆ day_minutes

integer(i4), parameter, public mo_datetime::day_minutes = DAY_HOURS * HOUR_MINUTES

minutes in day

Definition at line 143 of file mo_datetime.f90.

◆ day_seconds

integer(i4), parameter, public mo_datetime::day_seconds = DAY_MINUTES * MINUTE_SECONDS

seconds in day

Definition at line 144 of file mo_datetime.f90.

Referenced by t_add_td(), t_from_day_second(), td_init(), and td_total_seconds().

◆ hour_minutes

integer(i4), parameter, public mo_datetime::hour_minutes = 60_i4

minutes in hour

Definition at line 141 of file mo_datetime.f90.

Referenced by check_minute().

◆ hour_seconds

integer(i4), parameter, public mo_datetime::hour_seconds = HOUR_MINUTES * MINUTE_SECONDS

seconds in hour

Definition at line 145 of file mo_datetime.f90.

Referenced by one_hour(), t_day_second(), t_from_day_second(), and td_init().

◆ leap_year_days

integer(i4), parameter, public mo_datetime::leap_year_days = 366_i4

days in leap year

Definition at line 136 of file mo_datetime.f90.

Referenced by days_in_year().

◆ max_year

integer(i4), parameter mo_datetime::max_year = 9999_i4
private

maximum for year

Definition at line 150 of file mo_datetime.f90.

Referenced by check_year().

◆ min_year

integer(i4), parameter mo_datetime::min_year = 1_i4
private

minimum for year

Definition at line 149 of file mo_datetime.f90.

Referenced by check_year().

◆ minute_seconds

integer(i4), parameter, public mo_datetime::minute_seconds = 60_i4

seconds in minute

Definition at line 142 of file mo_datetime.f90.

Referenced by check_second(), one_minute(), t_day_second(), t_from_day_second(), and td_init().

◆ week_days

integer(i4), parameter, public mo_datetime::week_days = 7_i4

days in week

Definition at line 138 of file mo_datetime.f90.

Referenced by one_week(), td_init(), and weekday().

◆ week_hours

integer(i4), parameter, public mo_datetime::week_hours = WEEK_DAYS * DAY_HOURS

hours in week

Definition at line 146 of file mo_datetime.f90.

◆ week_minutes

integer(i4), parameter, public mo_datetime::week_minutes = WEEK_DAYS * DAY_MINUTES

minutes in week

Definition at line 147 of file mo_datetime.f90.

◆ week_seconds

integer(i4), parameter, public mo_datetime::week_seconds = WEEK_DAYS * DAY_SECONDS

seconds in week

Definition at line 148 of file mo_datetime.f90.

◆ year_days

integer(i4), parameter, public mo_datetime::year_days = 365_i4

days in standard year

Definition at line 135 of file mo_datetime.f90.

Referenced by days_before_year(), and days_in_year().

◆ year_months

integer(i4), parameter, public mo_datetime::year_months = 12_i4

months in year

Definition at line 137 of file mo_datetime.f90.

Referenced by check_month(), doy_to_month_day(), and weekday().