DL Logo

ASCalendarTimeSpan Structures

_t_ASCalendarTimeSpan

Header: ASExpT.h:4062

Description

Represents a calendar time span used to calculate ambiguous time spans such as 1 year and 3 months. A calendar time span cannot be negative.

Syntax

struct _t_ASCalendarTimeSpan {
ASUns32 Year;
Year.
ASUns32 Month;
Month.
ASUns32 Day;
Day.
ASUns32 Hour;
Hour.
ASUns32 Minute;
Minute.
ASUns32 Second;
Second.
} ASCalendarTimeSpanRec, *ASCalendarTimeSpan;

Used By

ASCalendarTimeSpan Functions

ASCalendarTimeSpanAddWithBase

Header: ASExtraProcs.h:1997

Description

Adds two calendar time spans, storing the result in another calendar time span object. Because the values in a calendar time span are not absolute (for example, a leap year has a different number of days), they are resolved with respect to the base date before the addition is done. The result is broken down into years, months, and so on, in the highest denomination possible. For example, a difference of 13 months is reported as 1 year and 1 month.

Syntax

void ASCalendarTimeSpanAddWithBase(const ASCalendarTimeSpan timeSpan1, const ASCalendarTimeSpan timeSpan2, const ASDate baseDate, ASCalendarTimeSpan result);

Parameters

timeSpan1
The first calendar time span to add.
timeSpan2
The calendar time span to add.
baseDate
The base date, or NULL to use Jan 1 1970 00:00:00, the epoch time.
result
The calendar time span structure in which to store the result.

ASCalendarTimeSpanCompare

Header: ASExtraProcs.h:1960

Description

Compares two calendar time spans with respect to a base date. Because the values in a calendar time span are not absolute (for example, a leap year has a different number of days), they are resolved with respect to the base date before the comparison is made.

Syntax

ASInt32 ASCalendarTimeSpanCompare(const ASCalendarTimeSpan timeSpan1, const ASCalendarTimeSpan timeSpan2, const ASDate baseDate);

Parameters

timeSpan1
The first calendar time span.
timeSpan2
The second calendar time span.
baseDate
The base date, or NULL to use Jan 1 1970 00:00:00, the epoch time.

Returns

1 if timeSpan1 > timeSpan2, 0 if they are equal, and-1 if timeSpan1 < timeSpan2.

ASCalendarTimeSpanDiff

Header: ASExtraProcs.h:2035

Description

Calculates the difference between calendar time span objects and stores the result in the provided ASCalendarTimeSpan object. If timeSpan2 is less than timeSpan1, the result is negative. Because the values in a calendar time span are not absolute (for example, a leap year has a different number of days), they are resolved with respect to the base date before the addition is done. The result is broken down into years, months, and so on, in the highest denomination possible. For example, a difference of 13 months is reported as 1 year and 1 month.

Syntax

void ASCalendarTimeSpanDiff(const ASCalendarTimeSpan timeSpan1, const ASCalendarTimeSpan timeSpan2, const ASDate baseDate, ASCalendarTimeSpan result);

Parameters

timeSpan1
The first calendar time span.
timeSpan2
The second calendar time span.
baseDate
The base date, or NULL to use Jan 1 1970 00:00:00, the epoch time.
result
The calendar time span object in which to store the difference.