libc-strftime 0.2.0

A wrapper library for the glibc strftime function
Documentation
  • Coverage
  • 100%
    8 out of 8 items documented1 out of 8 items with examples
  • Size
  • Source code size: 10.21 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.35 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • cecton/libc-strftime
    3 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • cecton

Build Status Latest Version License Docs.rs LOC Dependency Status

libc-strftime

A wrapper library for the glibc strftime function.

Why?

There is currently no way in Rust to get translated date and time.

Examples

Format the current date and time in Brussels in French:

use std::env;

env::set_var("LC_ALL", "fr_BE.UTF-8");
env::set_var("TZ", "Europe/Brussels");

libc_strftime::tzset();
libc_strftime::set_locale();

let now = libc_strftime::epoch(); // most likely a u64
let local = libc_strftime::strftime_local("%c", now);
println!("On est: {}", local); // On est: mer 07 aoû 2019 06:19:56 CEST

Known Issues

  • The translation doesn't seem to work with MUSL.