Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

TimeDeltaImpl

Fully qualified path: chrono::time_delta::TimeDeltaImpl

pub impl TimeDeltaImpl of TimeDeltaTrait;

Impl constants

MIN

The minimum possible TimeDelta: -i64::MAX milliseconds.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::MIN

const MIN: TimeDelta = TimeDelta { secs: -Bounded::<i64>::MAX / MILLIS_PER_SEC };

MAX

The maximum possible TimeDelta: i64::MAX milliseconds.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::MAX

const MAX: TimeDelta = TimeDelta { secs: Bounded::<i64>::MAX / MILLIS_PER_SEC };

Impl functions

new

Makes a new TimeDelta with given number of seconds and nanoseconds.

Errors

Returns None when the duration is out of bounds, or if nanos ≥ 1,000,000,000.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::new

fn new(secs: i64) -> Option<TimeDelta>

weeks

Makes a new TimeDelta with the given number of weeks.

Equivalent to TimeDelta::seconds(weeks * 7 * 24 * 60 * 60) with overflow checks.

Panics

Panics when the duration is out of bounds.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::weeks

fn weeks(weeks: i64) -> TimeDelta

try_weeks

Makes a new TimeDelta with the given number of weeks.

Equivalent to TimeDelta::try_seconds(weeks * 7 * 24 * 60 * 60) with overflow checks.

Errors

Returns None when the TimeDelta would be out of bounds.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::try_weeks

fn try_weeks(weeks: i64) -> Option<TimeDelta>

days

Makes a new TimeDelta with the given number of days.

Equivalent to TimeDelta::seconds(days * 24 * 60 * 60) with overflow checks.

Panics

Panics when the TimeDelta would be out of bounds.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::days

fn days(days: i64) -> TimeDelta

try_days

Makes a new TimeDelta with the given number of days.

Equivalent to TimeDelta::try_seconds(days * 24 * 60 * 60) with overflow checks.

Errors

Returns None when the TimeDelta would be out of bounds.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::try_days

fn try_days(days: i64) -> Option<TimeDelta>

hours

Makes a new TimeDelta with the given number of hours.

Equivalent to TimeDelta::seconds(hours * 60 * 60) with overflow checks.

Panics

Panics when the TimeDelta would be out of bounds.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::hours

fn hours(hours: i64) -> TimeDelta

try_hours

Makes a new TimeDelta with the given number of hours.

Equivalent to TimeDelta::try_seconds(hours * 60 * 60) with overflow checks.

Errors

Returns None when the TimeDelta would be out of bounds.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::try_hours

fn try_hours(hours: i64) -> Option<TimeDelta>

minutes

Makes a new TimeDelta with the given number of minutes.

Equivalent to TimeDelta::seconds(minutes * 60) with overflow checks.

Panics

Panics when the TimeDelta would be out of bounds.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::minutes

fn minutes(minutes: i64) -> TimeDelta

try_minutes

Makes a new TimeDelta with the given number of minutes.

Equivalent to TimeDelta::try_seconds(minutes * 60) with overflow checks.

Errors

Returns None when the TimeDelta would be out of bounds.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::try_minutes

fn try_minutes(minutes: i64) -> Option<TimeDelta>

seconds

Makes a new TimeDelta with the given number of seconds.

Panics

Panics when seconds is more than i64::MAX / 1_000 or less than -i64::MAX / 1_000 (in this context, this is the same as i64::MIN / 1_000 due to rounding).

Fully qualified path: chrono::time_delta::TimeDeltaImpl::seconds

fn seconds(seconds: i64) -> TimeDelta

try_seconds

Makes a new TimeDelta with the given number of seconds.

Errors

Returns None when seconds is more than i64::MAX / 1_000 or less than -i64::MAX / 1_000 (in this context, this is the same as i64::MIN / 1_000 due to rounding).

Fully qualified path: chrono::time_delta::TimeDeltaImpl::try_seconds

fn try_seconds(seconds: i64) -> Option<TimeDelta>

num_weeks

Returns the total number of whole weeks in the TimeDelta.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::num_weeks

fn num_weeks(self: TimeDelta) -> i64

num_days

Returns the total number of whole days in the TimeDelta.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::num_days

fn num_days(self: TimeDelta) -> i64

num_hours

Returns the total number of whole hours in the TimeDelta.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::num_hours

fn num_hours(self: TimeDelta) -> i64

num_minutes

Returns the total number of whole minutes in the TimeDelta.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::num_minutes

fn num_minutes(self: TimeDelta) -> i64

num_seconds

Returns the total number of whole seconds in the TimeDelta.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::num_seconds

fn num_seconds(self: @TimeDelta) -> i64

checked_add

Add two TimeDeltas, returning None if overflow occurred.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::checked_add

fn checked_add(self: @TimeDelta, rhs: TimeDelta) -> Option<TimeDelta>

checked_sub

Subtract two TimeDeltas, returning None if overflow occurred.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::checked_sub

fn checked_sub(self: @TimeDelta, rhs: TimeDelta) -> Option<TimeDelta>

checked_mul

Multiply a TimeDelta with a i32, returning None if overflow occurred.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::checked_mul

fn checked_mul(self: @TimeDelta, rhs: i32) -> Option<TimeDelta>

checked_div

Divide a TimeDelta with a i32, returning None if dividing by 0.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::checked_div

fn checked_div(self: @TimeDelta, rhs: i32) -> Option<TimeDelta>

abs

Returns the TimeDelta as an absolute (non-negative) value.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::abs

fn abs(self: @TimeDelta) -> TimeDelta

zero

A TimeDelta where the stored seconds and nanoseconds are equal to zero.

Fully qualified path: chrono::time_delta::TimeDeltaImpl::zero

fn zero() -> TimeDelta

is_zero

Returns true if the TimeDelta equals TimeDelta::zero().

Fully qualified path: chrono::time_delta::TimeDeltaImpl::is_zero

fn is_zero(self: @TimeDelta) -> bool