RedTime:
Filter:
redSys/Classes (extension) | Red > redTools

RedTime
ExtensionExtension

calculate with time

Description

A simple class for keeping track of and calculating with time.

Instance Methods

+

Adds time. Wraps around 00:00:00 - 23:59:59

Returns:

-

Subtracts time. Wraps around 00:00:00 - 23:59:59

Returns:

==

Compare with another RedTime instance.

Returns:

.addHour

Arguments:

hour

A SimpleNumber.

.addMin

Arguments:

min

A SimpleNumber.

.addSec

Arguments:

sec

A SimpleNumber.

.asArray

For example [6, 0, 15] //h:m:s

Returns:

An Array.

.asHours

Calculates the number of hours using ((h*3600)+(m*60)+s)/60/60.

Returns:

A Float.

.asMinutes

Calculates the number of minutes using ((h*3600)+(m*60)+s)/60.

Returns:

A Float.

.asSeconds

Calculates the number of seconds using (h*3600)+(m*60)+s.

Returns:

.h

Hours.

Returns:

.m

Minutes.

Returns:

.s

Seconds.

Returns:

.setLocalTime

Uses Date.localtime to reset -h, -m, -s.

Examples