跳转到正文

<kiyosi/core/time.hpp> ​

cpp
#include <kiyosi/core/time.hpp>

Date ​

cpp
using kiyosi::Date = std::chrono::sys_days

Civil date represented as a day on the system clock timeline.

Timestamp ​

cpp
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 ​

cpp
bool kiyosi::is_supported_date(Date value) noexcept

Tests whether a date is representable by std::chrono::year. 参数

  • value — Date to test.

返回值: true when value is in the supported inclusive civil-date range.

start_of_day ​

cpp
Timestamp kiyosi::start_of_day(Date value) noexcept

Converts a date to its midnight timestamp. 参数

  • value — Date to convert.

返回值: Timestamp at the start of value.

date_of ​

cpp
Date kiyosi::date_of(Timestamp value) noexcept

Extracts the civil date containing a timestamp. 参数

  • value — Timestamp to convert.

返回值: Date obtained by flooring value to whole days.

validate_instrument_life ​

cpp
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 ​

cpp
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 ​

cpp
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.