pub struct Date { /* private fields */ }
Expand description

An actual, absolute date.

As opposed to SinceStart which represents a point in time as a duration since the start date of the run of the program being profiled.

In practice, this type is just a wrapper around a chrono date.

Implementations

Constructor from a unix timestamp.

Examples
use base::prelude::time::*;
let (secs, subsec_nanos) = (1566489242, 7000572);
let date = Date::from_timestamp(secs, subsec_nanos);
assert_eq! { date.timestamp(), (secs, subsec_nanos) }

The current date.

Constructor from an ocaml duration.

Examples
use base::prelude::time::*;
let secs = 156648924_u64;
let subsec_micros = 270005_u32;
let micros = secs * 1_000_000 + (subsec_micros as u64);
let date = Date::from_micros(micros);
assert_eq! { date.timestamp(), (secs as i64, subsec_micros * 1_000) }

Date accessor.

Timestamp version of a date.

Returns a pair ( timestamp’s seconds , timestamp’s subsec nanoseconds ).

Examples
use base::prelude::time::*;
let (secs, subsec_nanos) = (1_566_489_242, 7_000_572);
let date = Date::from_timestamp(secs, subsec_nanos);
assert_eq! { date.timestamp(), (secs, subsec_nanos) }

The hours/minutes/seconds/millis of a date.

This is currently used only for debugging purposes.

Examples
use base::prelude::time::*;
let mut date = Date::from_timestamp(1566489242, 7000572);
let (_h, m, s, mi) = date.time_info();
// Can't check the hours as this depends on the local system time.
assert_eq! {  m, 54 }
assert_eq! {  s, 2 }
assert_eq! { mi, 7 }

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

Adds a duration.

Examples

use base::prelude::time::*;
let (secs, subsec_nanos) = (1_566_489_242, 7_000_572);
let mut date = Date::from_timestamp(secs, subsec_nanos);
let duration = SinceStart::parse_secs("7.003000001").unwrap();
date = date + duration;
assert_eq! { date.timestamp(), (secs + 7, subsec_nanos + 3_000_001) }

The resulting type after applying the + operator.

Performs the + operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

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

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

Information used during parsing.

Parses something, given some info.

Parses something when no info is needed.

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

This method tests for !=.

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

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

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

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

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

Serialize this value into the given Serde serializer. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

The error type produced by a failed conversion.

Convert the given value into an approximately equivalent representation.

The error type produced by a failed conversion.

Convert the subject into an approximately equivalent representation.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Approximate the subject with the default scheme.

Approximate the subject with a specific scheme.

Approximate the subject to a given type with the default scheme.

Approximate the subject to a given type with a specific scheme.

Convert the subject to a given type.

Attempt to convert the subject to a given type.

Attempt a value conversion of the subject to a given type.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The error type produced by a failed conversion.

Convert the given value into the subject type.

The type returned in the event of a conversion error.

Performs the conversion.

The error type produced by a failed conversion.

Convert the subject into the destination type.

The type returned in the event of a conversion error.

Performs the conversion.

The error type produced by a failed conversion.

Convert the given value into an exactly equivalent representation.

The error type produced by a failed conversion.

Convert the subject into an exactly equivalent representation.