Advance or retard a hzXDate by a number of months. Returns: None
| Return Type | Function name | Arguments |
|---|---|---|
| void | hzXDate::altmon | (int32_t,) |
Declared in file: hzDate.h
Defined in file : hzDate.cpp
Function Logic:
Function body:
void hzXDate::altmon (int32_t nounits)
{
// Advance or retard a hzXDate by a number of months.
//
// Arguments: 1) nounits Number of units (months) into future/past
// Returns: None
uint32_t days ; // Used by date - no of days conversion
uint32_t Y ; // Year part
uint32_t M ; // Month part
uint32_t D ; // Day part
days = m_hour/24;
_datefromdays(Y, M, D, days) ;
if (nounits > 0)
{
for (; nounits > 0; nounits--)
{
if (nounits > 12)
{ Y++ ; nounits -= 11;continue ; }
M = M == 12?1: M + 1;
}
if (D > monlen(Y, M))
D = monlen(Y, M) ;
}
if (nounits < 0)
{
for (; nounits < 0; nounits++)
{
if (nounits < -12)
{ Y-- ; nounits += 11;continue ; }
M = M == 1? 12:M - 1;
}
if (D > monlen(Y, M))
D = monlen(Y, M) ;
}
_daysfromdate(days, Y, M, D) ;
days *= 24;
days += (m_hour%24);
m_hour = days ;
}