date_time
予定通りBoost.DateTimeを使ってiso9660::date_timeとfilesystem::timestampの相互変換を実装してみました。
date_time.hppの差分
binary_date_time→timestampの場合はこんな感じです。
struct binary_date_time { boost::optional<filesystem::timestamp> to_timestamp() const { using namespace boost::posix_time; using namespace boost::gregorian; if (empty()) return boost::optional<filesystem::timestamp>(); // yearのバイアスは1900 ptime pt(date(1900+year,month,day), time_duration(hour,minute,second)); // timezoneは15分単位 // 60分以上や負の値でも大丈夫 pt -= minutes(timezone*15); // timestampの紀元 const ptime epoch(date(1970, 1, 1), time_duration()); // 紀元からの秒数 return filesystem::timestamp((pt - epoch).total_seconds(), 0); } // ... };
iso9660::headerの時間を全部timestampに置き換えてしまいましたが、これだとタイムゾーンを指定できなくなるので、date_timeのままが良かったかもしれません。
他のHamigaki.Archiversコンポーネントも含め、調整していきます。