コード例 #1
0
ファイル: Duration.cs プロジェクト: minam365/JavApi
 /*
  * <p>Returns the length of the duration in milli-seconds.</p>
  *
  * <p>If the seconds field carries more digits than milli-second order,
  * those will be simply discarded (or in other words, rounded to zero.)
  * For example, for any Calendar value <code>x</code>,</p>
  * <pre>
  * <code>new Duration("PT10.00099S").getTimeInMills(x) == 10000</code>.
  * <code>new Duration("-PT10.00099S").getTimeInMills(x) == -10000</code>.
  * </pre>
  *
  * <p/>
  * Note that this method uses the {@link #addTo(Calendar)} method,
  * which may work incorrectly with <code>Duration</code> objects with
  * very large values in its fields. See the {@link #addTo(Calendar)}
  * method for details.
  *
  * @param startInstant
  *      The length of a month/year varies. The <code>startInstant</code> is
  *      used to disambiguate this variance. Specifically, this method
  *      returns the difference between <code>startInstant</code> and
  *      <code>startInstant+duration</code>
  *
  * @return milliseconds between <code>startInstant</code> and
  *   <code>startInstant</code> plus this <code>Duration</code>
  *
  * @throws NullPointerException if <code>startInstant</code> parameter
  * is null.
  *
  */
 public long getTimeInMillis(java.util.Calendar startInstant)
 {
     java.util.Calendar cal = (java.util.Calendar)startInstant.clone();
     addTo(cal);
     return(getCalendarTimeInMillis(cal)
            - getCalendarTimeInMillis(startInstant));
 }