From 48f3b73b915e64b89be4951fdd69d22c89089077 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sun, 9 Dec 2018 00:11:07 +0900 Subject: [PATCH] add ctor(local_datetime, time_offset) to offset_datetime --- toml/datetime.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/toml/datetime.hpp b/toml/datetime.hpp index c0d9e6e..768b1ca 100644 --- a/toml/datetime.hpp +++ b/toml/datetime.hpp @@ -361,26 +361,25 @@ operator<<(std::basic_ostream& os, const local_datetime& dt) struct offset_datetime { - local_date date; - local_time time; + local_date date; + local_time time; time_offset offset; offset_datetime(local_date d, local_time t, time_offset o) : date(d), time(t), offset(o) {} - + offset_datetime(const local_datetime& dt, time_offset o) + : date(dt.date), time(dt.time), offset(o) + {} offset_datetime(const local_datetime& ld) : date(ld.date), time(ld.time), offset(get_local_offset()) {} - offset_datetime(const std::chrono::system_clock::time_point& tp) : offset_datetime(local_datetime(tp)) {} - offset_datetime(const std::time_t& t) : offset_datetime(local_datetime(t)) {} - offset_datetime(const std::tm& t) : offset_datetime(local_datetime(t)) {}