#string-literal #build #timestamp #proc-macro #date-time #tool #format-string

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

#181 in Build Utils

Download history 12311/week @ 2024-03-14 11114/week @ 2024-03-21 11758/week @ 2024-03-28 11505/week @ 2024-04-04 11079/week @ 2024-04-11 12633/week @ 2024-04-18 12184/week @ 2024-04-25 12030/week @ 2024-05-02 11890/week @ 2024-05-09 11409/week @ 2024-05-16 11230/week @ 2024-05-23 12361/week @ 2024-05-30 12412/week @ 2024-06-06 12817/week @ 2024-06-13 12597/week @ 2024-06-20 9923/week @ 2024-06-27

49,765 downloads per month
Used in 58 crates (10 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");

lib.rs:

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.4–7MB
~42K SLoC