UniversalTimeScale Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
There are quite a few different conventions for binary datetime, depending on different platforms and protocols.
[Android.Runtime.Register("android/icu/util/UniversalTimeScale", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class UniversalTimeScale : Java.Lang.Object
[<Android.Runtime.Register("android/icu/util/UniversalTimeScale", ApiSince=26, DoNotGenerateAcw=true)>]
type UniversalTimeScale = class
inherit Object
- Inheritance
- Attributes
Remarks
There are quite a few different conventions for binary datetime, depending on different platforms and protocols. Some of these have severe drawbacks. For example, people using Unix time (seconds since Jan 1, 1970, usually in a 32-bit integer) think that they are safe until near the year 2038. But cases can and do arise where arithmetic manipulations causes serious problems. Consider the computation of the average of two datetimes, for example: if one calculates them with averageTime = (time1 + time2)/2
, there will be overflow even with dates beginning in 2004. Moreover, even if these problems don't occur, there is the issue of conversion back and forth between different systems.
Binary datetimes differ in a number of ways: the datatype, the unit, and the epoch (origin). We refer to these as time scales.
ICU implements a universal time scale that is similar to the .NET framework's System.DateTime. The universal time scale is a 64-bit integer that holds ticks since midnight, January 1st, 0001. (One tick is 100 nanoseconds.) Negative values are supported. This has enough range to guarantee that calculations involving dates around the present are safe.
The universal time scale always measures time according to the proleptic Gregorian calendar. That is, the Gregorian calendar's leap year rules are used for all times, even before 1582 when it was introduced. (This is different from the default ICU calendar which switches from the Julian to the Gregorian calendar in 1582. See GregorianCalendar.setGregorianChange() and ucal_setGregorianChange().)
ICU provides conversion functions to and from all other major time scales, allowing datetimes in any time scale to be converted to the universal time scale, safely manipulated, and converted back to any other datetime time scale.
For more details and background, see the Universal Time Scale chapter in the ICU User Guide.
Java documentation for android.icu.util.UniversalTimeScale
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Fields
Db2Time |
Obsolete.
Used in DB2. |
DotnetDateTime |
Obsolete.
Used in the . |
EpochOffsetPlus1Value |
Obsolete.
The constant used to select the epoch plus one value for a time scale. |
EpochOffsetValue |
Obsolete.
The constant used to select the epoch offset value for a time scale. |
ExcelTime |
Obsolete.
Used in Excel. |
FromMaxValue |
Obsolete.
The constant used to select the maximum from value for a time scale. |
FromMinValue |
Obsolete.
The constant used to select the minimum from value for a time scale. |
Icu4cTime |
Obsolete.
Used in the ICU4C. |
JavaTime |
Obsolete.
Used in the JDK. |
MacOldTime |
Obsolete.
Used in older Macintosh systems. |
MacTime |
Obsolete.
Used in the JDK. |
MaxScale |
This is the first unused time scale value. |
ToMaxValue |
Obsolete.
The constant used to select the maximum to value for a time scale. |
ToMinValue |
Obsolete.
The constant used to select the minimum to value for a time scale. |
UnitsValue |
Obsolete.
The constant used to select the units value for a time scale. |
UnixMicrosecondsTime |
Obsolete.
Data is a |
UnixTime |
Obsolete.
Used in Unix systems. |
WindowsFileTime |
Obsolete.
Used in Windows for file times. |
Properties
Class |
Returns the runtime class of this |
Handle |
The handle to the underlying Android instance. (Inherited from Object) |
JniIdentityHashCode | (Inherited from Object) |
JniPeerMembers | |
PeerReference | (Inherited from Object) |
ThresholdClass |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
ThresholdType |
This API supports the Mono for Android infrastructure and is not intended to be used directly from your code. (Inherited from Object) |
Methods
BigDecimalFrom(BigDecimal, UniversalTimeScaleType) |
Convert a |
BigDecimalFrom(Double, UniversalTimeScaleType) |
Convert a |
BigDecimalFrom(Int64, UniversalTimeScaleType) |
Convert a |
Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
Dispose() | (Inherited from Object) |
Dispose(Boolean) | (Inherited from Object) |
Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
From(Int64, UniversalTimeScaleType) |
Convert a |
GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
GetTimeScaleValue(UniversalTimeScaleType, UniversalTimeScaleValue) |
Get a value associated with a particular time scale. |
JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
ToArray<T>() | (Inherited from Object) |
ToBigDecimal(BigDecimal, UniversalTimeScaleType) |
Convert a datetime from the universal time scale to a |
ToBigDecimal(Int64, UniversalTimeScaleType) |
Convert a datetime from the universal time scale to a |
ToLong(Int64, UniversalTimeScaleType) |
Convert a datetime from the universal time scale stored as a |
ToString() |
Returns a string representation of the object. (Inherited from Object) |
UnregisterFromRuntime() | (Inherited from Object) |
Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
Explicit Interface Implementations
IJavaPeerable.Disposed() | (Inherited from Object) |
IJavaPeerable.DisposeUnlessReferenced() | (Inherited from Object) |
IJavaPeerable.Finalized() | (Inherited from Object) |
IJavaPeerable.JniManagedPeerState | (Inherited from Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from Object) |
Extension Methods
JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
JavaCast<TResult>(IJavaObject) | |
GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |