Add a durationFrom method in TimeStamped

Hi all,

I would like to have your views on the following feature. Do you think it could be interesting to add a method durationFrom in TimeStamped interface?
It could be a default method like:

defaut double durationFrom(TimeStamped other) {
    return getDate().durationFrom(other.getDate());
}

Like that, the following code

AbsoluteDate date = ...
CartesianOrbit orbit = ...
SpacecraftState state = ...
Opm opm = ...
StateCovariance stateCovariance = ...

orbit.getDate().durationFrom(date);
state.getDate().durationFrom(date);
opm.getDate().durationFrom(date);
stateCovariance.getDate().durationFrom(state.getDate());

Could be replaced by

orbit.durationFrom(date);
state.durationFrom(date);
opm.durationFrom(date);
stateCovariance.durationFrom(state);

Thanks to this method, we could have simpler code and reduce the calls to getDate() method to compute durations.

Bryan

Good idea, +1

Sounds good.

Romain.

You have my :+1:

Thanks for your supports! Issue opened: Add TimeStamped#durationFrom method (#1139) · Issues · Orekit / Orekit · GitLab