From: <sv...@ww...> - 2005-03-12 05:25:07
|
Author: mkrose Date: 2005-03-11 21:24:58 -0800 (Fri, 11 Mar 2005) New Revision: 1491 Modified: trunk/CSP/SimData/CHANGES.current trunk/CSP/SimData/Include/SimData/Date.h Log: Add a method to DateZulu to get the time offset relative to another DateZulu instance in seconds. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1491 Modified: trunk/CSP/SimData/CHANGES.current =================================================================== --- trunk/CSP/SimData/CHANGES.current 2005-03-05 23:31:36 UTC (rev 1490) +++ trunk/CSP/SimData/CHANGES.current 2005-03-12 05:24:58 UTC (rev 1491) @@ -1,6 +1,10 @@ Version 0.4.0 (in progress) =========================== +2005-03-11: onsight + * Add a method to DateZulu to get the time offset relative to another + DateZulu instance in seconds. + 2005-02-16: delta * For some reasons, vs 2005 needs some template(!) classes to be exported whereas vs 2003 doesn't allow it... Back to a version Modified: trunk/CSP/SimData/Include/SimData/Date.h =================================================================== --- trunk/CSP/SimData/Include/SimData/Date.h 2005-03-05 23:31:36 UTC (rev 1490) +++ trunk/CSP/SimData/Include/SimData/Date.h 2005-03-12 05:24:58 UTC (rev 1491) @@ -669,6 +669,18 @@ return days; } + /** Get the time relative to a reference date and time in seconds. + * + * @param reference The reference data and time. + * @returns The number of seconds relative to the reference time (positive + * if the current time is greater than the reference time). + */ + double getRelativeTime(DateZulu const &reference) const { + const double dj = getJulian() - reference.getJulian(); + const double dt = getTime() - reference.getTime(); + return dj * 86400.0 + dt; + } + /** Get the real-valued Julian date. * * @returns The Julian date and time as a real value, |