<kiyosi/core/time.hpp>
#include <kiyosi/core/time.hpp>Date
using kiyosi::Date = std::chrono::sys_daysCivil date represented as a day on the system clock timeline.
Timestamp
using kiyosi::Timestamp = std::chrono::sys_time<std::chrono::microseconds>UTC-like instant with microsecond precision; date-only expiry and observation events occur at 00:00 UTC. Its range covers every supported civil date and the elapsed time between any two of them.
is_supported_date
bool kiyosi::is_supported_date(Date value) noexceptTests whether a date is representable by std::chrono::year. 参数
value—Dateto test.
返回值: true when value is in the supported inclusive civil-date range.
start_of_day
Timestamp kiyosi::start_of_day(Date value) noexceptConverts a date to its midnight timestamp. 参数
value—Dateto convert.
返回值: Timestamp at the start of value.
date_of
Date kiyosi::date_of(Timestamp value) noexceptExtracts the civil date containing a timestamp. 参数
value—Timestampto convert.
返回值: Date obtained by flooring value to whole days.
validate_instrument_life
Result<void> kiyosi::validate_instrument_life(Date effective_date, Date expiry_date)Validates the inclusive dates of an instrument's life. 返回值: Success, invalid_date for unsupported dates, or invalid_time_range for reversed dates.
validate_valuation_within_instrument_life
Result<void> kiyosi::validate_valuation_within_instrument_life(Date valuation_date, Date effective_date, Date expiry_date)Validates that a valuation date lies within an instrument's inclusive life. 返回值: Success, or an invalid_date or invalid_time_range error.
validate_valuation_within_instrument_life
Result<void> kiyosi::validate_valuation_within_instrument_life(Timestamp valuation_time, Date effective_date, Date expiry_date)Validates that a valuation timestamp lies within an instrument's inclusive life. 返回值: Success, or an invalid_date or invalid_time_range error.