#libc #calendar #strftime #glibc

libc-strftime

A wrapper library for the glibc strftime function

2 unstable releases

0.2.0 Aug 15, 2019
0.1.0 Aug 7, 2019

#96 in Date and time

Download history 17/week @ 2021-02-20 19/week @ 2021-02-27 14/week @ 2021-03-06 14/week @ 2021-03-13 17/week @ 2021-03-20 27/week @ 2021-03-27 20/week @ 2021-04-03 19/week @ 2021-04-10 23/week @ 2021-04-17 14/week @ 2021-04-24 17/week @ 2021-05-01 13/week @ 2021-05-08 12/week @ 2021-05-15 12/week @ 2021-05-22 15/week @ 2021-05-29 19/week @ 2021-06-05

75 downloads per month
Used in 3 crates (2 directly)

MIT license

9KB
125 lines

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.

Dependencies

~28KB