Libraries
Duration Source Code
 previous   up   next 

Types
duration
Describes time and date durations.

duration

const type: duration

Describes time and date durations.


Operator Summary
duration
(attr duration) parse (in string: stri)
Convert a string to a duration.
boolean
(in duration: aDuration1) = (in duration: aDuration2)
Check if two duration values are equal.
boolean
(in duration: aDuration1) <> (in duration: aDuration2)
Check if two duration values are not equal.
boolean
(in duration: aDuration1) <= (in duration: aDuration2)
Check if aDuration1 is less than or equal to aDuration2.
boolean
(in duration: aDuration1) >= (in duration: aDuration2)
Check if aDuration1 is greater than or equal to aDuration2.
boolean
(in duration: aDuration1) < (in duration: aDuration2)
Check if aDuration1 is less than aDuration2.
boolean
(in duration: aDuration1) > (in duration: aDuration2)
Check if aDuration1 is greater than aDuration2.
duration
+ (in duration: aDuration)
Plus sign for durations.
duration
- (in duration: aDuration)
Minus sign, negate a duration.
duration
(in duration: aDuration1) + (in duration: aDuration2)
Add two durations.
duration
(in duration: aDuration1) - (in duration: aDuration2)
Compute the subtraction of two durations.
duration
(in integer: number) * (in duration: aDuration)
Multiply a duration by a number.
duration
(in duration: aDuration) * (in integer: number)
Multiply a duration by a number.
void
(inout duration: aDuration) +:= (in duration: delta)
Increment a duration by a delta.
void
(inout duration: aDuration) -:= (in duration: delta)
Decrement a duration by a delta.
void
(inout time: tim) +:= (in duration: aDuration)
Increment a time by a duration.
void
(inout time: tim) -:= (in duration: aDuration)
Decrement a time by a duration.
time
(in time: tim) + (in duration: aDuration)
Add a duration to a time.
time
(in time: tim) - (in duration: aDuration)
Subtract a duration from a time.
duration
(in time: tim1) - (in time: tim2)
Subtract two times.

Function Summary
integer
getYears (in duration: aDuration)
Obtain the years of a duration.
integer
getMonths (in duration: aDuration)
Obtain the months of a duration.
integer
getDays (in duration: aDuration)
Obtain the days of a duration.
integer
getHours (in duration: aDuration)
Obtain the hours of a duration.
integer
getMinutes (in duration: aDuration)
Obtain the minutes of a duration.
integer
getSeconds (in duration: aDuration)
Obtain the seconds of a duration.
integer
getMicroSeconds (in duration: aDuration)
Obtain the micro seconds of a duration.
string
str (in duration: aDuration)
Convert a duration to a string.
string
literal (in duration: aDuration)
Convert a duration to a duration literal.
duration
duration (in var string: stri)
Convert a string to a duration.
integer
compare (in duration: aDuration1, in duration: aDuration2)
Compares two durations.
integer
hashCode (in duration: aDuration)
Compute the hash value of aDuration.
integer
toYears (in duration: aDuration)
Compute the years of aDuration.
integer
toMonths (in duration: aDuration)
Compute the months of aDuration.
integer
toDays (in duration: aDuration)
Compute the days of aDuration.
integer
toHours (in duration: aDuration)
Compute the hours of aDuration.
integer
toMinutes (in duration: aDuration)
Compute the minutes of aDuration.
integer
toSeconds (in duration: aDuration)
Compute the seconds of aDuration.
integer
toMicroSeconds (in duration: aDuration)
Compute the micro seconds of aDuration.
void
wait (in duration: aDuration)
Wait for a given duration.

Operator Detail

parse

const func duration: (attr duration) parse (in string: stri)

Convert a string to a duration.

Parameters:
stri - A duration in the format P[nY][nM][nD][T[nH][nM][n[.n]S]]
Returns:
the duration result of the conversion.
Raises:
RANGE_ERROR - If stri contains not a valid duration value.

=

const func boolean: (in duration: aDuration1) = (in duration: aDuration2)

Check if two duration values are equal.

Returns:
TRUE if both durations are equal, FALSE otherwise.

<>

const func boolean: (in duration: aDuration1) <> (in duration: aDuration2)

Check if two duration values are not equal.

Returns:
FALSE if both durations are equal, TRUE otherwise.

<=

const func boolean: (in duration: aDuration1) <= (in duration: aDuration2)

Check if aDuration1 is less than or equal to aDuration2.

Returns:
TRUE if aDuration1 is less than or equal to aDuration2, FALSE otherwise.

>=

const func boolean: (in duration: aDuration1) >= (in duration: aDuration2)

Check if aDuration1 is greater than or equal to aDuration2.

Returns:
TRUE if aDuration1 is greater than or equal to aDuration2, FALSE otherwise.

<

const func boolean: (in duration: aDuration1) < (in duration: aDuration2)

Check if aDuration1 is less than aDuration2.

Returns:
TRUE if aDuration1 is less than aDuration2, FALSE otherwise.

>

const func boolean: (in duration: aDuration1) > (in duration: aDuration2)

Check if aDuration1 is greater than aDuration2.

Returns:
TRUE if aDuration1 is greater than aDuration2, FALSE otherwise.

+

const func duration: + (in duration: aDuration)

Plus sign for durations.

Returns:
its operand unchanged.

-

const func duration: - (in duration: aDuration)

Minus sign, negate a duration.

Returns:
the negated duration.

+

const func duration: (in duration: aDuration1) + (in duration: aDuration2)

Add two durations.

Returns:
the sum of the two durations.

-

const func duration: (in duration: aDuration1) - (in duration: aDuration2)

Compute the subtraction of two durations.

Returns:
the difference of the two durations.

*

const func duration: (in integer: number) * (in duration: aDuration)

Multiply a duration by a number.

Returns:
the multiplied duration.

*

const func duration: (in duration: aDuration) * (in integer: number)

Multiply a duration by a number.

Returns:
the multiplied duration.

+:=

const proc: (inout duration: aDuration) +:= (in duration: delta)

Increment a duration by a delta.


-:=

const proc: (inout duration: aDuration) -:= (in duration: delta)

Decrement a duration by a delta.


+:=

const proc: (inout time: tim) +:= (in duration: aDuration)

Increment a time by a duration.


-:=

const proc: (inout time: tim) -:= (in duration: aDuration)

Decrement a time by a duration.


+

const func time: (in time: tim) + (in duration: aDuration)

Add a duration to a time.

Returns:
the time result of the addition.

-

const func time: (in time: tim) - (in duration: aDuration)

Subtract a duration from a time.

Returns:
the time result of the subtraction.

-

const func duration: (in time: tim1) - (in time: tim2)

Subtract two times.

Returns:
the duration between the two points in time.

Function Detail

getYears

const func integer: getYears (in duration: aDuration)

Obtain the years of a duration.

Returns:
the years of a duration.

getMonths

const func integer: getMonths (in duration: aDuration)

Obtain the months of a duration.

Returns:
the months of a duration.

getDays

const func integer: getDays (in duration: aDuration)

Obtain the days of a duration.

Returns:
the days of a duration.

getHours

const func integer: getHours (in duration: aDuration)

Obtain the hours of a duration.

Returns:
the hours of a duration.

getMinutes

const func integer: getMinutes (in duration: aDuration)

Obtain the minutes of a duration.

Returns:
the minutes of a duration.

getSeconds

const func integer: getSeconds (in duration: aDuration)

Obtain the seconds of a duration.

Returns:
the seconds of a duration.

getMicroSeconds

const func integer: getMicroSeconds (in duration: aDuration)

Obtain the micro seconds of a duration.

Returns:
the micro seconds of a duration.

str

const func string: str (in duration: aDuration)

Convert a duration to a string. The duration format is P[nY][nM][nD][T[nH][nM][n[.n]S]], where n is a signed decimal of a date or time element.

str(duration("P1Y2M3DT4H5M6S"))  returns  "P1Y2M3DT4H5M6S"
Returns:
the result of the conversion.

literal

const func string: literal (in duration: aDuration)

Convert a duration to a duration literal.

Returns:
the duration literal.

duration

const func duration: duration (in var string: stri)

Convert a string to a duration.

Parameters:
stri - A duration in the format P[nY][nM][nD][T[nH][nM][n[.n]S]]
Returns:
the duration result of the conversion.
Raises:
RANGE_ERROR - If stri contains not a valid duration value.

compare

const func integer: compare (in duration: aDuration1, in duration: aDuration2)

Compares two durations.

Returns:
-1, 0 or 1 if the first argument is considered to be respectively less than, equal to, or greater than the second.

hashCode

const func integer: hashCode (in duration: aDuration)

Compute the hash value of aDuration.

Returns:
the hash value.

toYears

const func integer: toYears (in duration: aDuration)

Compute the years of aDuration.

Returns:
the duration in years.

toMonths

const func integer: toMonths (in duration: aDuration)

Compute the months of aDuration.

Returns:
the duration in months.

toDays

const func integer: toDays (in duration: aDuration)

Compute the days of aDuration.

Returns:
the duration in days.

toHours

const func integer: toHours (in duration: aDuration)

Compute the hours of aDuration.

Returns:
the duration in hours.

toMinutes

const func integer: toMinutes (in duration: aDuration)

Compute the minutes of aDuration.

Returns:
the duration in minutes.

toSeconds

const func integer: toSeconds (in duration: aDuration)

Compute the seconds of aDuration.

Returns:
the duration in seconds.

toMicroSeconds

const func integer: toMicroSeconds (in duration: aDuration)

Compute the micro seconds of aDuration.

Returns:
the duration in micro seconds.

wait

const proc: wait (in duration: aDuration)

Wait for a given duration.



 previous   up   next