#build-tool #proc-macro #timestamp #build-timestamp

macro build build-time

Simple proc-macros to generate build timestamp string literals

4 releases

0.1.3 May 1, 2023
0.1.2 Aug 5, 2022
0.1.1 Jun 24, 2021
0.1.0 May 31, 2021

#303 in Build Utils

Download history 18102/week @ 2025-06-09 16691/week @ 2025-06-16 17280/week @ 2025-06-23 16688/week @ 2025-06-30 14611/week @ 2025-07-07 14196/week @ 2025-07-14 15622/week @ 2025-07-21 15087/week @ 2025-07-28 16658/week @ 2025-08-04 19177/week @ 2025-08-11 19275/week @ 2025-08-18 19610/week @ 2025-08-25 20632/week @ 2025-09-01 19887/week @ 2025-09-08 17608/week @ 2025-09-15 16794/week @ 2025-09-22

76,684 downloads per month
Used in 71 crates (11 directly)

MIT license

7KB

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");

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");

Dependencies

~1.2–2.1MB
~39K SLoC