get_current_timestamp

Function get_current_timestamp 

Source
pub fn get_current_timestamp() -> String
Expand description

Gets the current Unix timestamp as a string.

This function returns the current time as a Unix timestamp (number of seconds since January 1, 1970 UTC) formatted as a string. Unix timestamps are commonly used in API requests that require time-based parameters or for generating unique identifiers based on time.

§Returns

A String containing the current Unix timestamp

§Examples

use qobuz_api_rust::utils::get_current_timestamp;
use std::thread::sleep;
use std::time::Duration;

let timestamp1 = get_current_timestamp();
sleep(Duration::from_millis(1000)); // Sleep for 1 second
let timestamp2 = get_current_timestamp();
// The timestamps should be different (or the same if called in the same second)