Gif, a new datetime library for Rust, makes working with dates and times simpler and faster. Gif’s focus is on safe, unambiguous use of date and time types, as well as high performance.
Advertisement
library supplies “Daytime primitive” according to initiator Burnsushi and supports it International Time Zone Database As well as summer (DST, daylight saving time) and winter time. It provides rounding, formatting and parsing functions. By request Serd can be integratedto sort formats. It serves as a model for GIF Temporal Library for JavaScript,
gif supports unix, where the time zone table is located /usr/share/zoneinfo
and Windows, where gif integrates its own zone database. To determine the system time, gif reads /etc/localtime
(Unix) respectively GetDynamicTimeZoneInformation
(Windows). The author hopes other platforms will follow, but says he relies on contributors here. His primary goal is “to get Gif to a stable 1.0 level as soon as possible. The reason for this is so that others can rely on Gif as a public dependency…”
BetterCode() Rust 2024 will take place on November 5. The fourth edition of the online conference organized by iX and dpunkt.verlag focuses on the topic of embedded development. bettercode() rust 2024 Shows how to develop for microcontrollers with Rust, what the advantages of the language are, especially for safety-critical systems, and how to integrate inevitable unsafe code sections as safely as possible.

conference program Provides lectures on the following topics:
- Embedded development with Rust: security and performance combined
- Asynchronous Rust: More Efficient Embedded Development
- unsafe for work
- Between man and machine: Embedded UI
- Rust in the automotive sector
- Secure and Open: Rust and RISC-V
Tickets to the conference Available until October 8 at an introductory price of 229 euros (all prices plus VAT).
The following example shows how developers parse a typical RFC 3339 timestamp, convert it to a zone-dependent DateTime, add a time period to it and finally output it without any loss:
use jiff::{Timestamp, ToSpan};
fn main() -> Result<(), jiff::Error> {
let time: Timestamp = "2024-07-11T01:14:00Z".parse()?;
let zoned = time.intz("America/New_York")?.checked_add(1.month().hours(2))?;
assert_eq!(zoned.to_string(), "2024-08-10T23:14:00-04:00(America/New_York)");
// Or, if you want an RFC3339 formatted string:
assert_eq!(zoned.timestamp().to_string(), "2024-08-11T03:14:00Z");
Ok(())
}
Search Users GIF on Crate.io and add this cargo add jiff
cargo.toml. It is under MIT and unlicensed. Minimum required Rust version is 1.70.0. BurnSushi’s GitHub page also a document Comparison with other Rust timing functions,
(Who)
