Struct osc_address::AbsOscTime
[−]
[src]
pub struct AbsOscTime { /* fields omitted */ }
OSC uses ntp time, i.e. absolute # of seconds since 1970 + a fraction of a second.
Methods
impl AbsOscTime
[src]
fn new(sec: u32, frac: u32) -> Self
Create a OSC time from seconds and a fraction of a second.
It is assumed that (sec, frac) != (0, 1)
-- otherwise the time should
be represented as OscTime::Now
.
fn from_system_time(t: SystemTime) -> Option<Self>
std::time::SystemTime
-> AbsOscTime
.
Note that the OSC time can only represent dates out to year 2036,
but SystemTime
allows greater range. Hence, this returns None
if the
time is not representable.
fn sec(&self) -> u32
Number of seconds since Jan 1, 1900.
fn frac(&self) -> u32
Number of 1/2^32
th fractional seconds to be added with the sec()
field.
e.g. 1000
represents 1000/2^32
seconds.
fn sec_frac(&self) -> (u32, u32)
The number of whole seconds and fractional seconds, as a tuple.
fn as_system_time(&self) -> Option<SystemTime>
Convert the OSC time tag into a type from the std::time
library.
This may fail because std::time
only allows times >= unix epoch (1970),
whereas OSC allows times >= 1900.
Upon such failure, None
is returned.
Trait Implementations
impl Copy for AbsOscTime
[src]
impl Clone for AbsOscTime
[src]
fn clone(&self) -> AbsOscTime
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more