Skip to main content

Crate system_time

Crate system_time 

Source
Expand description

system-time

A library for fetching the current time based on the system’s locale settings.

Constants§

COMMON_YEAR
Day count of every month in a common (non-leap) year.
DAYS
Abbreviated English weekday names, indexed by weekday number.
LANG_AR_SA_LOCALE
POSIX locale string of the Arabic (Saudi Arabia) UTF-8 encoding.
LANG_AR_SA_NAME
Human-readable name of the Arabic (Saudi Arabia) locale.
LANG_DE_DE_LOCALE
POSIX locale string of the German (Germany) UTF-8 encoding.
LANG_DE_DE_NAME
Human-readable name of the German (Germany) locale.
LANG_ENV_VAR
Environment variable holding the locale of the current session.
LANG_EN_US_LOCALE
POSIX locale string of the English (United States) UTF-8 encoding.
LANG_EN_US_NAME
Human-readable name of the English (United States) locale.
LANG_ES_ES_LOCALE
POSIX locale string of the Spanish (Spain) UTF-8 encoding.
LANG_ES_ES_NAME
Human-readable name of the Spanish (Spain) locale.
LANG_FI_FI_LOCALE
POSIX locale string of the Finnish (Finland) UTF-8 encoding.
LANG_FI_FI_NAME
Human-readable name of the Finnish (Finland) locale.
LANG_FR_FR_LOCALE
POSIX locale string of the French (France) UTF-8 encoding.
LANG_FR_FR_NAME
Human-readable name of the French (France) locale.
LANG_HI_IN_LOCALE
POSIX locale string of the Hindi (India) UTF-8 encoding.
LANG_HI_IN_NAME
Human-readable name of the Hindi (India) locale.
LANG_IT_IT_LOCALE
POSIX locale string of the Italian (Italy) UTF-8 encoding.
LANG_IT_IT_NAME
Human-readable name of the Italian (Italy) locale.
LANG_JA_JP_LOCALE
POSIX locale string of the Japanese (Japan) UTF-8 encoding.
LANG_JA_JP_NAME
Human-readable name of the Japanese (Japan) locale.
LANG_KO_KR_LOCALE
POSIX locale string of the Korean (South Korea) UTF-8 encoding.
LANG_KO_KR_NAME
Human-readable name of the Korean (South Korea) locale.
LANG_NL_NL_LOCALE
POSIX locale string of the Dutch (Netherlands) UTF-8 encoding.
LANG_NL_NL_NAME
Human-readable name of the Dutch (Netherlands) locale.
LANG_PT_PT_LOCALE
POSIX locale string of the Portuguese (Portugal) UTF-8 encoding.
LANG_PT_PT_NAME
Human-readable name of the Portuguese (Portugal) locale.
LANG_RU_RU_LOCALE
POSIX locale string of the Russian (Russia) UTF-8 encoding.
LANG_RU_RU_NAME
Human-readable name of the Russian (Russia) locale.
LANG_SV_SE_LOCALE
POSIX locale string of the Swedish (Sweden) UTF-8 encoding.
LANG_SV_SE_NAME
Human-readable name of the Swedish (Sweden) locale.
LANG_TH_TH_LOCALE
POSIX locale string of the Thai (Thailand) UTF-8 encoding.
LANG_TH_TH_NAME
Human-readable name of the Thai (Thailand) locale.
LANG_VI_VN_LOCALE
POSIX locale string of the Vietnamese (Vietnam) UTF-8 encoding.
LANG_VI_VN_NAME
Human-readable name of the Vietnamese (Vietnam) locale.
LANG_ZH_CN_LOCALE
POSIX locale string of the Chinese (China) UTF-8 encoding.
LANG_ZH_CN_NAME
Human-readable name of the Chinese (China) locale.
LEAP_YEAR
Day count of every month in a leap year.
MONTHS
Abbreviated English month names, indexed by month number minus one.

Functions§

calculate_time
Calculates the current year, month, day, hour, minute, second, millisecond and microsecond.
compute_date
Computes the year, month, and day from days since Unix epoch (1970-01-01).
date
Gets the current day, without the time.
day
Gets the current day.
from_env_var
Gets the time zone offset from the system environment variable.
gmt
Gets the current date and time in GMT format.
hour
Gets the current hour.
is_leap_year
Determines if a year is a leap year.
micros
Gets the current timestamp in microseconds.
millis
Gets the current timestamp in milliseconds.
minute
Gets the current minute.
month
Gets the current month.
second
Gets the current second.
time
Gets the current time, including the date and time.
time_micros
Gets the current time with microseconds, including the date and time.
time_millis
Gets the current time with milliseconds, including the date and time.
timestamp
Gets the current timestamp in seconds since Unix epoch.
timestamp_micros
Gets the current timestamp in microseconds since Unix epoch.
timestamp_millis
Gets the current timestamp in milliseconds since Unix epoch.
year
Gets the current year.