Enum netsblox_vm::runtime::SysTime
source · pub enum SysTime {
Timeless,
Arbitrary {
ms: u64,
},
Real {
local: OffsetDateTime,
},
}
Expand description
The time as determined by an implementation of System
.
Variants§
Timeless
No concept of time. This should only be produced as a last resort, as it disables all time-based features.
Arbitrary
A time measurement from an arbitrary (but consistent during runtime) starting point, which must be measured in milliseconds. For instance, this could be used to measure uptime on systems that do not support reading real time.
Real
Fields
§
local: OffsetDateTime
A real-world time measurement.
This is always preferable over SysTime::Arbitrary
.
The value is assumed to already be transformed to local time.
Implementations§
source§impl SysTime
impl SysTime
sourcepub fn to_arbitrary_ms<C: CustomTypes<S>, S: System<C>>(
&self
) -> Result<u64, ErrorCause<C, S>>
pub fn to_arbitrary_ms<C: CustomTypes<S>, S: System<C>>( &self ) -> Result<u64, ErrorCause<C, S>>
Attempt to convert this time into milliseconds after some arbitrary starting point.
sourcepub fn to_real_local<C: CustomTypes<S>, S: System<C>>(
&self
) -> Result<OffsetDateTime, ErrorCause<C, S>>
pub fn to_real_local<C: CustomTypes<S>, S: System<C>>( &self ) -> Result<OffsetDateTime, ErrorCause<C, S>>
Attempt to convert this time into a real world time in the local timezone.
Auto Trait Implementations§
impl RefUnwindSafe for SysTime
impl Send for SysTime
impl Sync for SysTime
impl Unpin for SysTime
impl UnwindSafe for SysTime
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more