本文整理汇总了C#中biz.ritter.javapi.getTime方法的典型用法代码示例。如果您正苦于以下问题:C# biz.ritter.javapi.getTime方法的具体用法?C# biz.ritter.javapi.getTime怎么用?C# biz.ritter.javapi.getTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类biz.ritter.javapi
的用法示例。
在下文中一共展示了biz.ritter.javapi.getTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getTimeInMillis
/**
* <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 <code>Date</code> 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(Date)} method,
* which may work incorrectly with <code>Duration</code> objects with
* very large values in its fields. See the {@link #addTo(Date)}
* 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>.
*
* @throws NullPointerException
* If the startInstant parameter is null.
*
* @return milliseconds between <code>startInstant</code> and
* <code>startInstant</code> plus this <code>Duration</code>
*
* @see #getTimeInMillis(Calendar)
*/
public long getTimeInMillis(java.util.Date startInstant)
{
java.util.Calendar cal = new java.util.GregorianCalendar();
cal.setTime(startInstant);
this.addTo(cal);
return getCalendarTimeInMillis(cal) - startInstant.getTime();
}
示例2: getCalendarTimeInMillis
/**
* <p>Calls the {@link Calendar#getTimeInMillis} method.
* Prior to JDK1.4, this method was protected and therefore
* cannot be invoked directly.</p>
*
* <p>TODO: In future, this should be replaced by <code>cal.getTimeInMillis()</code>.</p>
*
* @param cal <code>Calendar</code> to get time in milliseconds.
*
* @return Milliseconds of <code>cal</code>.
*/
private static long getCalendarTimeInMillis(java.util.Calendar cal)
{
return cal.getTime().getTime();
}
示例3: compareTo
/**
* Compares this {@code Timestamp} object with a supplied {@code Timestamp}
* object.
*
* @param theObject
* the timestamp to compare with this {@code Timestamp} object,
* passed as an {@code Object}.
* @return <dd>
* <dl>
* {@code 0} if the two {@code Timestamp} objects are equal in time
* </dl>
* <dl>
* a value {@code < 0} if this {@code Timestamp} object is before
* the supplied {@code Timestamp} and a value
* </dl>
* <dl>
* {@code > 0} if this {@code Timestamp} object is after the
* supplied {@code Timestamp}
* </dl>
* </dd>
* @throws ClassCastException
* if the supplied object is not a {@code Timestamp} object.
*/
public override int compareTo(java.util.Date theObject)
{
if (theObject is Timestamp)
{
return this.compareTo((Timestamp)theObject);
}
if (this.getTime() < theObject.getTime())
{
return -1;
}
if (this.getTime() > theObject.getTime())
{
return 1;
}
if (this.getNanos() % 1000000 > 0)
{
return 1;
}
return 0;
}