fortplot_datetime Module

Minimal datetime utilities for date/time axes.

Provides: - datetime_t derived type - Unix seconds <-> datetime conversion (UTC, proleptic Gregorian) - Julian day <-> Unix seconds conversion - Small strftime-like formatter (limited tokens)



Variables

Type Visibility Attributes Name Initial
real(kind=wp), public, parameter :: SECONDS_PER_DAY = 86400.0_wp
real(kind=wp), public, parameter :: JD_UNIX_EPOCH = 2440587.5_wp

Derived Types

type, public ::  datetime_t

Components

Type Visibility Attributes Name Initial
integer, public :: year = 1970
integer, public :: month = 1
integer, public :: day = 1
integer, public :: hour = 0
integer, public :: minute = 0
integer, public :: second = 0

Functions

public pure elemental function datetime_to_unix_seconds(dt) result(seconds)

Arguments

Type IntentOptional Attributes Name
type(datetime_t), intent(in) :: dt

Return Value integer(kind=int64)

public pure elemental function unix_seconds_to_datetime(seconds) result(dt)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: seconds

Return Value type(datetime_t)

public pure function unix_seconds_from_julian_day(jd) result(seconds)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: jd

Return Value integer(kind=int64)

public pure function julian_day_from_unix_seconds(seconds) result(jd)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: seconds

Return Value real(kind=wp)

public pure function format_unix_seconds(seconds, format) result(text)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: seconds
character(len=*), intent(in) :: format

Return Value character(len=64)