Skip to main content

Module time

Module time 

Source
Expand description

Time handling and formatting.

Structsยง

LocaleFormatCache ๐Ÿ”’
Cached locale-specific formatting properties.
TimeFormat
How to format the time stamps.
TimeFormatter
Formatter for time strings with caching of computed values. Enables efficient formatting of multiple time values with the same timescale and format settings.
TimeInputState
State for the time input widget.
TimeScale

Enumsยง

TimeStringFormatting
How to format the numeric part of the time string.
TimeUnit

Constantsยง

DEFAULT_TIMELINE_NAME
THIN_SPACE ๐Ÿ”’
TICK_STEPS
Candidate multipliers used to choose tick spacing.

Staticsยง

LOCALE_FORMAT_CACHE ๐Ÿ”’

Functionsยง

create_cache ๐Ÿ”’
find_auto_scale ๐Ÿ”’
Heuristically find a suitable time unit for the given time.
format_locale ๐Ÿ”’
format_si ๐Ÿ”’
get_locale_format_cache ๐Ÿ”’
Get the cached locale formatting properties.
get_ticks_internal ๐Ÿ”’
Get suitable tick locations for the current view port. The method is based on guessing the length of the time string and is inspired by the corresponding code in Matplotlib.
normalize_numeric_with_unit ๐Ÿ”’
Convert a numeric string into an integer BigInt and normalized TimeUnit.
parse_time_input ๐Ÿ”’
Parse a time string and extract numeric value and unit (if present).
pow10 ๐Ÿ”’
Helper to compute powers of 10 efficiently. Returns precomputed values for exponents 0-21, or computes on-demand for others.
split_and_format_number ๐Ÿ”’
Format number based on TimeStringFormatting, i.e., possibly group digits together and use correct separator for each group.
split_numeric_parts ๐Ÿ”’
Split a numeric string into integer and fractional parts.
strip_trailing_zeros_and_period ๐Ÿ”’
Get rid of trailing zeros if the string contains a ., i.e., being fractional If the resulting string ends with ., remove that as well.
time_input_widget
Render a time input widget in egui.
time_string
Format the time string taking all settings into account. This function delegates to TimeFormatter which handles the Auto timeunit.
timeformat_menu
Draw the menu for selecting the time format.
timeunit_menu
Create menu for selecting preferred time unit.