In the class, I have a boost :: posix_time :: ptime attribute that refers to a date and time:
boost :: posix_time :: ptime p_;
In the constructor, I can pass values ββand set them without problems.
my_class::my_class( ... )
: p_( boost::posix_time::ptime( boost::gregorian::date(y,M,d),
hours(h) + minutes(m) + seconds(s) +
milliseconds(ms) + microseconds(us) +
nanosec(ns));
I would like to create set methods (add and subtract) the values ββfor all the fields of this ptime (year, month, day, hours ... if possible).
If I use ptime_.date (), it returns a link minus dates, and I cannot set it directly.
I would like to do something like this:
void my_class::set_year(qint64 y) {
}
Is it possible?
I thought about creating a reset (...) method and asked what I needed, but for this purpose it sounds strange (copy all the values ββand repeat them in the code).
Rgds.