pub fn commit_timestamp(explicit: Option<u64>) -> Result<u64, TimestampError>Expand description
Returns the timestamp of a new commit.
The timestamp is in seconds since the Unix epoch, UTC. The function takes it from the first of these sources that is set:
explicit- the
SOURCE_DATE_EPOCHenvironment variable - the system clock
The function trims white space from SOURCE_DATE_EPOCH before it parses
the value. If SOURCE_DATE_EPOCH is not valid Unicode, the function
treats it as unset.
ยงErrors
TimestampError::SourceDateEpochifexplicitisNoneandSOURCE_DATE_EPOCHis set to a value that is not a count of seconds. The function does not use the clock in this case, as the reproducible-build convention requires.TimestampError::ClockBeforeEpochif the function reads the system clock and the clock is before the Unix epoch.