Connect IQ > APIメモ > Toybox > Time > Duration

下位ページ

Content

Class: Toybox::Time::Duration


The Duration object represents an immutable span of time. This is the return value when requesting a time result in days or hours.

  • Since : 1.0.0

関数(要約) Duration

  • (Object) add(time) : Use add() to add a Moment or another Duration to a Duration.
  • (Number) compare(time) : Use compare() to determine if a Duration is shorter or longer than another Duration.
  • (Duration) divide(value) : Use divide() to divide a Duration by a value.
  • (Boolean) greaterThan(time) : Use lessThan() to determine if a Duration is longer than another Duration.
  • (Duration) initialize(value) constructor : Creates a Duration object.
  • (Boolean) lessThan(time) : ある Duration の値が別の Duration の値より小さいか(短いか)判定する
  • (Duration) multiply(value) : Use multiply() to multiply a Duration by a value.
  • (Duration) subtract(time) : Use subtract() to compute the delta between two Durations.
  • (Number) value : Get the Duration value with value().

コンストラクタ(詳細)

(Duration) initialize(value) : Duration オブジェクトを生成する

  • Parameters
    • value (Number) : [msec]
  • Since : 1.0.0

Instance Method Details

(Object) add(time) : Use add() to add a Moment or another Duration to a Duration.

  • Parameters
    • time : Duration or Moment to add to Duration
  • Returns : Duration + Moment = Moment, Duration + Duration = Duration

Since:

   1.0.0

  • (Number) compare(time)

Use compare() to determine if a Duration is shorter or longer than another Duration.

Parameters:

   time (Duration) —

   Duration to compare to this Duration

  • Returns : (Number) Negative if this < that, positive if this > that, 0 if this == that
  • Since : 1.0.0

(Duration) divide(value)


Use divide() to divide a Duration by a value.

Parameters:

   value —

   Number or Float to divide Duration

Returns:

   (Duration) —

   Result object of Duration / value

Since:

   1.0.0

  • (Boolean) greaterThan(time)

Use lessThan() to determine if a Duration is longer than another Duration.

Parameters:

   time (Duration) —

   Duration to compare to this Duration

Returns:

   (Boolean) —

   true if this is greater than that, false otherwise

Since:

   1.0.0

(Boolean) lessThan(time) : ある Duration の値が別の Duration の値より小さいか(短いか)判定する

  • Parameters
    • time (Duration) : Duration to compare to this Duration
  • Returns : (Boolean) 小さければ true
  • Since : 1.0.0

(Duration) multiply(value)


Use multiply() to multiply a Duration by a value.

  • Parameters
    • value : Number or Float to multiply with Duration
  • Returns : (Duration) Result object of Duration * value
  • Since : 1.0.0

(Duration) subtract(time) : 2つの Duration の差を計算する

  • Parameters
    • time (Duration) : Duration object used to find delta
  • Returns : (Duration) Duration object of Duration - time
  • Since : 1.0.0

(Number) value : 経過時間の値を秒で取得する

  • Returns : (Number) Duration in seconds
  • Since : 1.0.0
最終更新:2016年03月02日 23:52