こんにちは私はブーストPosix時間システムを使用しています。私はクラスにboost :: posix_time :: time_duration to string
class event{
private:
boost::posix_time::ptime time;
//some other stuufff
public:
string gettime(void);
}
//functions
string event::gettime(void){
return to_iso_extended_string(time.time_of_day());
}
を持っていますが、タイプ
boost::posix_time::time_duration
をto_iso_extended_string取らないだけで、これは私が後で文字列を返すようにしたいhere
を見ることができます
boost::posix_time
を入力します出力等
どうすればこの問題を解決できますか?私は変換するブーストの方法を見ることができません
boost::posix_time::time_duration
を文字列に変換します。私はC + +の両方に新しいので、これが本当のシンプルなものだと謝ります。
私が探していたが、boost :: posix_time :: time_durationの機能が見つからない – Tommy
ここをクリックしてください(文字列への変換):http://www.boost.org/doc/libs/1_45_0 /doc/html/date_time/posix_time.html#ptime_to_string – yasouser
これが問題の原因です。これは私が使っていたものです。 "time_duration"型以外のものではないので、 "time"は "ptime"型ですが、time.time_of_day()型は "time_duration"型ですので、o_iso_extended_string(time)はokです。 – Tommy