Struct chrono::naive::time::NaiveTime [] [src]

pub struct NaiveTime {
    // some fields omitted
}

ISO 8601 time without timezone. Allows for the nanosecond precision and optional leap second representation.

Methods

impl NaiveTime
[src]

fn from_hms(hour: u32, min: u32, sec: u32) -> NaiveTime

Makes a new NaiveTime from hour, minute and second.

Fails on invalid hour, minute and/or second.

fn from_hms_opt(hour: u32, min: u32, sec: u32) -> Option<NaiveTime>

Makes a new NaiveTime from hour, minute and second.

Returns None on invalid hour, minute and/or second.

fn from_hms_milli(hour: u32, min: u32, sec: u32, milli: u32) -> NaiveTime

Makes a new NaiveTime from hour, minute, second and millisecond. The millisecond part can exceed 1,000 in order to represent the leap second.

Fails on invalid hour, minute, second and/or millisecond.

fn from_hms_milli_opt(hour: u32, min: u32, sec: u32, milli: u32) -> Option<NaiveTime>

Makes a new NaiveTime from hour, minute, second and millisecond. The millisecond part can exceed 1,000 in order to represent the leap second.

Returns None on invalid hour, minute, second and/or millisecond.

fn from_hms_micro(hour: u32, min: u32, sec: u32, micro: u32) -> NaiveTime

Makes a new NaiveTime from hour, minute, second and microsecond. The microsecond part can exceed 1,000,000 in order to represent the leap second.

Fails on invalid hour, minute, second and/or microsecond.

fn from_hms_micro_opt(hour: u32, min: u32, sec: u32, micro: u32) -> Option<NaiveTime>

Makes a new NaiveTime from hour, minute, second and microsecond. The microsecond part can exceed 1,000,000 in order to represent the leap second.

Returns None on invalid hour, minute, second and/or microsecond.

fn from_hms_nano(hour: u32, min: u32, sec: u32, nano: u32) -> NaiveTime

Makes a new NaiveTime from hour, minute, second and nanosecond. The nanosecond part can exceed 1,000,000,000 in order to represent the leap second.

Fails on invalid hour, minute, second and/or nanosecond.

fn from_hms_nano_opt(hour: u32, min: u32, sec: u32, nano: u32) -> Option<NaiveTime>

Makes a new NaiveTime from hour, minute, second and nanosecond. The nanosecond part can exceed 1,000,000,000 in order to represent the leap second.

Returns None on invalid hour, minute, second and/or nanosecond.

fn from_num_seconds_from_midnight(secs: u32, nano: u32) -> NaiveTime

Makes a new NaiveTime from the number of seconds since midnight and nanosecond. The nanosecond part can exceed 1,000,000,000 in order to represent the leap second.

Fails on invalid number of seconds and/or nanosecond.

fn from_num_seconds_from_midnight_opt(secs: u32, nano: u32) -> Option<NaiveTime>

Makes a new NaiveTime from the number of seconds since midnight and nanosecond. The nanosecond part can exceed 1,000,000,000 in order to represent the leap second.

Returns None on invalid number of seconds and/or nanosecond.

fn parse_from_str(s: &str, fmt: &str) -> ParseResult<NaiveTime>

Parses a string with the specified format string and returns a new NaiveTime. See the format::strftime module on the supported escape sequences.

fn format_with_items<'a, I>(&self, items: I) -> DelayedFormat<I> where I: Iterator<Item=Item<'a>> + Clone

Formats the time with the specified formatting items.

fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>

Formats the time with the specified format string. See the format::strftime module on the supported escape sequences.

Trait Implementations

impl Clone for NaiveTime
[src]

fn clone(&self) -> NaiveTime

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

impl Copy for NaiveTime
[src]

impl Ord for NaiveTime
[src]

fn cmp(&self, __arg_0: &NaiveTime) -> Ordering

This method returns an Ordering between self and other. Read more

impl PartialOrd for NaiveTime
[src]

fn partial_cmp(&self, __arg_0: &NaiveTime) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more

fn lt(&self, __arg_0: &NaiveTime) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more

fn le(&self, __arg_0: &NaiveTime) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

fn gt(&self, __arg_0: &NaiveTime) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more

fn ge(&self, __arg_0: &NaiveTime) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Eq for NaiveTime
[src]

impl PartialEq for NaiveTime
[src]

fn eq(&self, __arg_0: &NaiveTime) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &NaiveTime) -> bool

This method tests for !=.

impl Timelike for NaiveTime
[src]

fn hour(&self) -> u32

Returns the hour number from 0 to 23.

fn minute(&self) -> u32

Returns the minute number from 0 to 59.

fn second(&self) -> u32

Returns the second number from 0 to 59.

fn nanosecond(&self) -> u32

Returns the number of nanoseconds since the whole non-leap second. The range from 1,000,000,000 to 1,999,999,999 represents the leap second. Read more

fn with_hour(&self, hour: u32) -> Option<NaiveTime>

Makes a new value with the hour number changed. Read more

fn with_minute(&self, min: u32) -> Option<NaiveTime>

Makes a new value with the minute number changed. Read more

fn with_second(&self, sec: u32) -> Option<NaiveTime>

Makes a new value with the second number changed. Read more

fn with_nanosecond(&self, nano: u32) -> Option<NaiveTime>

Makes a new value with nanoseconds since the whole non-leap second changed. Read more

fn num_seconds_from_midnight(&self) -> u32

Returns the number of non-leap seconds past the last midnight.

fn hour12(&self) -> (bool, u32)

Returns the hour number from 1 to 12 with a boolean flag, which is false for AM and true for PM. Read more

impl Hash for NaiveTime
[src]

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the state given, updating the hasher as necessary.

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0

Feeds a slice of this type into the state provided.

impl Add<Duration> for NaiveTime
[src]

type Output = NaiveTime

The resulting type after applying the + operator

fn add(self, rhs: Duration) -> NaiveTime

The method for the + operator

impl Sub<NaiveTime> for NaiveTime
[src]

type Output = Duration

The resulting type after applying the - operator

fn sub(self, rhs: NaiveTime) -> Duration

The method for the - operator

impl Sub<Duration> for NaiveTime
[src]

type Output = NaiveTime

The resulting type after applying the - operator

fn sub(self, rhs: Duration) -> NaiveTime

The method for the - operator

impl Debug for NaiveTime
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Display for NaiveTime
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl FromStr for NaiveTime
[src]

type Err = ParseError

The associated error which can be returned from parsing.

fn from_str(s: &str) -> ParseResult<NaiveTime>

Parses a string s to return a value of this type. Read more