Share via


CTimeSpan::operator +, -

Adds and subtracts CTimeSpan objects.

CTimeSpan operator +(
   CTimeSpan span 
) const throw( );
CTimeSpan operator -(
   CTimeSpan span 
) const throw( );

Parameters

  • span
    The value to add to the CTimeSpan object.

Return Value

A CTimeSpan object representing the result of the operation.

Remarks

These two operators allow you to add and subtract CTimeSpan objects to and from each other.

Example

CTimeSpan ts1(3, 1, 5, 12); // 3 days, 1 hour, 5 min, and 12 sec
CTimeSpan ts2(100); // 100 seconds
CTimeSpan ts3 = ts1 + ts2;
ATLASSERT(ts3.GetSeconds() == 52); // 6 mins, 52 secs   

Requirements

Header: atltime.h

See Also

Reference

CTimeSpan Class

Hierarchy Chart

Other Resources

CTimeSpan Members