-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support formatting from the 1989 C standard (like strptime and strftime) #181
Labels
Milestone
Comments
This formatting should heavily reuse the work in I think that the The formatting structure should also use The format string could be internally represented as: struct EpochFormat {
items: [Option<EpochItem>; 16],
num_items: usize
}
struct EpochItem {
token: Token,
sep_char: Option<char>,
sep_char_alt: Option<char>,
} Then, some formats could be defined at compile time. Date "only" would be (would be initialized at midnight): let date_only = EpochFormat {
items: [EpochItem { token: Token::Year, sep_char: Some('-'), sep_char_alt: None },
EpochItem { token: Token::Month, sep_char: Some('-'), sep_char_alt: None },
EpochItem { token: Token::Day, sep_char: Some('-'), sep_char_alt: None }],
num_items: 3
} |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This would allow formatting date times with the typical tokens like
%Y-%m-%d
. Chrono supports this, and its support should be used as a template for the Hifitime implementation: https://docs.rs/chrono/latest/chrono/format/index.html , https://docs.rs/chrono/latest/chrono/format/strftime/index.html .Time-rs also has extensive support for formatting: https://time-rs.github.io/book/api/well-known-format-descriptions.html .
The text was updated successfully, but these errors were encountered: