build-time

Crates.iobuild-time
lib.rsbuild-time
version0.1.3
sourcesrc
created_at2021-05-31 00:53:23.56669
updated_at2023-05-01 04:21:53.409744
descriptionSimple proc-macros to generate build timestamp string literals.
homepagehttps://github.com/AlephAlpha/build-time
repositoryhttps://github.com/AlephAlpha/build-time
max_upload_size
id404041
size9,412
(AlephAlpha)

documentation

README

build-time

Simple proc-macros to generate build timestamp string literals.

Based on Jasen Borisov's build_timestamp crate.

Two function like procedures are provided: build_time_utc and build_time_local.

They take an optional strftime date and time format string as input, and return a string literal. If the input is empty, they will return a string literal in RFC 3339 date and time format, e.g., "2021-05-29T06:55:50.418437046+00:00".

Requires Rust 1.45+ because these macros are used in expression positions.

Usage

use build_time::{build_time_utc, build_time_local};

// Returns the UTC build timestamp in RFC3339 date and time format.
let utc_build_time = build_time_utc!();

// Returns the local build timestamp in the specified format.
let local_build_time = build_time_local!("%Y-%m-%dT%H:%M:%S%.f%:z");
Commit count: 13

cargo fmt