FORCES
FORtran lib for Comp. Env. Sys.
|
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 | |
Types to deal with datetimes.
This module provides four types to deal with date and time
These type can be used in arithmetic operations (+, -, *, /) and can be compared (<, >, <=, >=, ==, /=) where it makes sense.
The following example demonstrates the functionality:
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:
COPYING
and COPYING.LESSER
provided with this software. The complete GNU license text can also be found at http://www.gnu.org/licenses/.
|
private |
check if a datetime is valid
[in] | year | 1 <= year <= 9999 |
[in] | month | 1 <= month <= 12 |
[in] | day | 1 <= day <= number of days in the given month and year |
[in] | hour | 0 <= hour < 24 |
[in] | minute | 0 <= minute < 60 |
[in] | second | 0 <= 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().
|
private |
check if a given day is valid
[in] | year | 1 <= year <= 9999 |
[in] | month | 1 <= month <= 12 |
[in] | day | 1 <= 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().
|
private |
check if a given hour is valid
[in] | hour | 0 <= hour < 24 |
Definition at line 563 of file mo_datetime.f90.
References day_hours.
Referenced by check_datetime().
|
private |
check if a given minute is valid
[in] | minute | 0 <= minute < 60 |
Definition at line 571 of file mo_datetime.f90.
References hour_minutes.
Referenced by check_datetime().
|
private |
check if a given month is valid
[in] | month | 1 <= month <= 12 |
Definition at line 545 of file mo_datetime.f90.
References year_months.
Referenced by check_datetime().
|
private |
check if a given second is valid
[in] | second | 0 <= second < 60 |
Definition at line 579 of file mo_datetime.f90.
References minute_seconds.
Referenced by check_datetime().
|
private |
check if a given year is valid
[in] | year | 1 <= year <= 9999 |
Definition at line 537 of file mo_datetime.f90.
References max_year, and min_year.
Referenced by check_datetime().
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().
|
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().
|
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().
|
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().
|
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().
|
private |
date from fractional julian day
[in] | julian | fractional julian day |
[in] | calendar | The 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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
private |
initialize a date
[in] | year | 1 (default) <= year <= 9999 |
[in] | month | 1 (default) <= month <= 12 |
[in] | day | 1 (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().
|
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().
|
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().
|
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().
|
private |
date as fractional julian day
[in] | calendar | The 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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
private |
new date with specified fields
[in] | year | 1 <= year <= 9999 |
[in] | month | 1 <= month <= 12 |
[in] | day | 1 <= 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().
|
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().
|
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().
|
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().
|
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().
|
private |
day of the week
Definition at line 1096 of file mo_datetime.f90.
References d_weekday(), and weekday().
Referenced by d_weekday().
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().
|
private |
number of days before a given year since year 1
[in] | year | 1 <= 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().
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
[in] | year | 1 <= year <= 9999 |
[in] | month | 1 <= 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().
pure integer(i4) function, public mo_datetime::days_in_year | ( | integer(i4), intent(in) | year | ) |
number of days in a given year
[in] | year | 1 <= 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().
|
private |
get date from day of the year
[in] | year | 1 <= year <= 9999 |
[in] | doy | 1 <= doy <= days_in_year (will be capped) |
[out] | month | month for the given doy |
[out] | day | day 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().
|
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().
|
private |
copy a datetime from a date
Definition at line 749 of file mo_datetime.f90.
Referenced by mo_datetime::datetime::assignment().
|
private |
copy a datetime
Definition at line 736 of file mo_datetime.f90.
Referenced by mo_datetime::datetime::assignment().
|
private |
day of the year
Definition at line 802 of file mo_datetime.f90.
References d_doy(), and dt_doy().
Referenced by dt_doy().
|
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().
|
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().
|
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().
|
private |
datetime from date and time
[in] | in_date | date to use |
[in] | in_time | time 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().
|
private |
datetime from fractional julian day
[in] | julian | fractional julian day |
[in] | calendar | The 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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
private |
initialize a datetime
[in] | year | 1 (default) <= year <= 9999 |
[in] | month | 1 (default) <= month <= 12 |
[in] | day | 1 (default) <= day <= number of days in the given month and year |
[in] | hour | 0 (default) <= hour < 24 |
[in] | minute | 0 (default) <= minute < 60 |
[in] | second | 0 (default) <= second < 60 |
Definition at line 610 of file mo_datetime.f90.
References check_datetime().
Referenced by dt_replace(), and now().
|
private |
datetime as fractional julian day
[in] | calendar | The 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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
private |
new datetime with specified fields
[in] | year | 1 <= year <= 9999 |
[in] | month | 1 <= month <= 12 |
[in] | day | 1 <= day <= number of days in the given month and year |
[in] | hour | 0 <= hour < 24 |
[in] | minute | 0 <= minute < 60 |
[in] | second | 0 <= second < 60 |
Definition at line 710 of file mo_datetime.f90.
References dt_init(), and dt_replace().
Referenced by dt_replace().
|
private |
|
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().
|
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().
|
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().
|
private |
day of the week
Definition at line 795 of file mo_datetime.f90.
References dt_weekday(), and weekday().
Referenced by dt_weekday().
|
private |
Definition at line 1530 of file mo_datetime.f90.
date of the datetime
Definition at line 762 of file mo_datetime.f90.
References get_date().
Referenced by get_date().
time of the datetime
Definition at line 771 of file mo_datetime.f90.
References get_time().
Referenced by get_time().
pure logical function, public mo_datetime::is_leap_year | ( | integer(i4), intent(in) | year | ) |
whether a given year is a leap year
[in] | year | 1 <= 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().
|
private |
datetime is a new day
Definition at line 830 of file mo_datetime.f90.
References is_new_day().
Referenced by is_new_day().
|
private |
datetime is a new hour
Definition at line 837 of file mo_datetime.f90.
References is_new_hour().
Referenced by is_new_hour().
|
private |
datetime is a new month
Definition at line 844 of file mo_datetime.f90.
References is_new_minute().
Referenced by is_new_minute().
|
private |
datetime is a new month
Definition at line 816 of file mo_datetime.f90.
References is_new_month().
Referenced by is_new_month().
|
private |
datetime is a new week
Definition at line 823 of file mo_datetime.f90.
References is_new_week().
Referenced by is_new_week().
|
private |
datetime is a new year
Definition at line 809 of file mo_datetime.f90.
References is_new_year().
Referenced by is_new_year().
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().
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().
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().
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().
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().
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().
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().
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().
|
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().
|
private |
copy a time
Definition at line 1333 of file mo_datetime.f90.
Referenced by mo_datetime::puretime::assignment().
|
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().
|
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().
|
private |
time from day second
[in] | day_second | second 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().
|
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().
|
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().
|
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().
|
private |
initialize a time
[in] | hour | 0 <= hour < 24 |
[in] | minute | 0 <= minute < 60 |
[in] | second | 0 (default) <= second < 60 |
Definition at line 1291 of file mo_datetime.f90.
References check_datetime().
Referenced by t_from_string(), and t_replace().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
private |
new time with specified fields
[in] | hour | 0 <= hour < 24 |
[in] | minute | 0 <= minute < 60 |
[in] | second | 0 <= second < 60 |
Definition at line 1343 of file mo_datetime.f90.
References t_init(), and t_replace().
Referenced by t_replace().
|
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().
|
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().
|
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().
absolute timedelta
Definition at line 1509 of file mo_datetime.f90.
References td_abs().
Referenced by td_abs().
|
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().
|
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().
|
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().
|
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().
|
private |
copy a timedelta
Definition at line 1538 of file mo_datetime.f90.
Referenced by mo_datetime::timedelta::assignment().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
private |
initialize a timedelta
[in] | days | days defining time-span |
[in] | seconds | seconds defining time-span |
[in] | minutes | minutes defining time-span |
[in] | hours | hours defining time-span |
[in] | weeks | weeks 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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
negative timedelta
Definition at line 1603 of file mo_datetime.f90.
References td_neg().
Referenced by mo_datetime::timedelta::operator(), and td_neg().
|
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().
positive timedelta
Definition at line 1610 of file mo_datetime.f90.
References td_pos().
Referenced by mo_datetime::timedelta::operator(), and td_pos().
|
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().
|
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().
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().
|
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().
type(puredate) function, public mo_datetime::today |
|
private |
day of the week
[in] | year | 1 <= year <= 9999 |
[in] | month | 1 <= month <= 12 |
[in] | day | 1 <= 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().
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().
integer(i4), parameter, public mo_datetime::clock_hours = 12_i4 |
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().
integer(i4), parameter, public mo_datetime::day_minutes = DAY_HOURS * HOUR_MINUTES |
minutes in day
Definition at line 143 of file mo_datetime.f90.
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().
integer(i4), parameter, public mo_datetime::hour_minutes = 60_i4 |
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().
integer(i4), parameter, public mo_datetime::leap_year_days = 366_i4 |
|
private |
|
private |
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().
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().
integer(i4), parameter, public mo_datetime::week_hours = WEEK_DAYS * DAY_HOURS |
hours in week
Definition at line 146 of file mo_datetime.f90.
integer(i4), parameter, public mo_datetime::week_minutes = WEEK_DAYS * DAY_MINUTES |
minutes in week
Definition at line 147 of file mo_datetime.f90.
integer(i4), parameter, public mo_datetime::week_seconds = WEEK_DAYS * DAY_SECONDS |
seconds in week
Definition at line 148 of file mo_datetime.f90.
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().
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().