use std::time::{SystemTime, UNIX_EPOCH};
fn main() {
// Generate a build hash based on current timestamp
let timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.expect("Time went backwards")
.as_secs();
// Create a short hash from timestamp (last 8 hex digits)
let build_hash = format!("{:x}", timestamp).chars().rev().take(8).collect::<String>().chars().rev().collect::<String>();
// Set as environment variable for compile time
println!("cargo:rustc-env=BUILD_HASH={}", build_hash);
// Rerun if build.rs changes
println!("cargo:rerun-if-changed=build.rs");
}