time
UCloud provides a Time
object which should be used for all actions which require a timestamp. The timestamps used in UCloud are always returned as time expressed as milliseconds since the time 00:00:00 UTC on January 1, 1970.
Example: Retrieving the current time
object Time : TimeProvider
object Time : TimeProvider
Properties:
Changing the provider
allows you to mock the time. This is extremely useful for testing time-releated code. You should never change the provider
in UCloud production code.
Member functions:
Returns the current time expressed as milliseconds since the time 00:00:00 UTC on January 1, 1970. See also System.currentTimeMillis.
object SystemTimeProvider : TimeProvider
object SystemTimeProvider : TimeProvider
Provides the default time provider. This delegates to System.currentTimeMillis()
.
object StaticTimeProvider : TimeProvider
object StaticTimeProvider : TimeProvider
Provides a TimeProvider
which has a static value which can be changed by the user.
Properties:
The time
property will be returned every time some code calls StaticTimeProvider.now()
. No synchronization is done on this property.
Last updated