PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800

◆ parse_date()

static double pism::parse_date ( const std::string &  input,
const units::Unit time_units,
const std::string &  calendar 
)
static

Parse the date.

input can be

  • a YYYY-MM-DD date (YYYY can be negative)
  • a number (interpreted as the number of years since the reference date in time_units)
  • a number with units attached ("1 day", etc) interpreted as time since the reference date in time_units

Definition at line 251 of file Time.cc.

References pism::RuntimeError::add_context(), calendar(), ccs_date2jday(), ccs_free_calendar(), ccs_init_calendar(), pism::units::convert(), pism::RuntimeError::formatted(), increment_date(), pism::array::max(), member(), pism::array::min(), n, parse_integer(), PISM_ERROR_LOCATION, split(), string_strip(), pism::units::Unit::system(), and pism::units::Unit::time().

Referenced by end_time(), pism::Time::parse_list(), pism::Time::parse_range(), and start_time().