Compartilhar via


COleDateTimeSpan::operator +, -

Add, subtract, and change sign for COleDateTimeSpan values.

COleDateTimeSpan operator +( 
   const COleDateTimeSpan& dateSpan  
) const throw( ); 
COleDateTimeSpan operator -( 
   const COleDateTimeSpan& dateSpan  
) const throw( ); 
COleDateTimeSpan operator -( ) const throw( );

Remarks

The first two operators let you add and subtract date/time-span values. The third lets you change the sign of a date/time-span value.

If either of the operands is null, the status of the resulting COleDateTimeSpan value is null.

If either of the operands is invalid and the other is not null, the status of the resulting COleDateTimeSpan value is invalid.

For more information on the valid, invalid, and null status values, see the m_status member variable.

Example

COleDateTimeSpan ts1(3, 1, 5, 12); // 3 days, 1 hour, 5 min, and 12 sec
COleDateTimeSpan ts2(100.0 / (24 * 3600.0)); // 100 seconds
COleDateTimeSpan ts3 = ts1 + ts2;
ASSERT(ts3.GetSeconds() == 52); // 6 mins, 52 secs   

Requirements

Header: atlcomtime.h

See Also

Reference

COleDateTimeSpan Class

Hierarchy Chart

COleDateTimeSpan::operator +=, -=