Struct glean_core::metrics::DatetimeMetric[][src]

pub struct DatetimeMetric { /* fields omitted */ }
Expand description

A datetime metric.

Used to record an absolute date and time, such as the time the user first ran the application.

Implementations

Creates a new datetime metric.

Sets the metric to a date/time including the timezone offset.

Arguments

  • glean - the Glean instance this metric belongs to.
  • year - the year to set the metric to.
  • month - the month to set the metric to (1-12).
  • day - the day to set the metric to (1-based).
  • hour - the hour to set the metric to.
  • minute - the minute to set the metric to.
  • second - the second to set the metric to.
  • nano - the nanosecond fraction to the last whole second.
  • offset_seconds - the timezone difference, in seconds, for the Eastern Hemisphere. Negative seconds mean Western Hemisphere.

Sets the metric to a date/time which including the timezone offset.

Arguments

  • glean - the Glean instance this metric belongs to.
  • value - Some DateTime value, with offset, to set the metric to. If none, the current local time is used.

Test-only API (exported for FFI purposes).

Gets the stored datetime value.

The precision of this value is truncated to the time_unit precision.

Arguments

  • glean - the Glean instance this metric belongs to.
  • storage_name - the storage name to look into.

Returns

The stored value or None if nothing stored.

Test-only API (exported for FFI purposes).

Gets the currently stored value as a String.

The precision of this value is truncated to the time_unit precision.

This doesn’t clear the stored value.

Trait Implementations

Formats the value using the given formatter. Read more

Access the stored metadata

Access the stored metadata mutable

Whether this metric should currently be recorded Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.