Function build_data::get_source_time[][src]

pub fn get_source_time() -> Result<i64, String>

Gets the modification time of the source code.

Reads the SOURCE_DATE_EPOCH env var if set. Otherwise, runs git to get the value.

Errors

Returns an error when:

  • SOURCE_DATE_EPOCH is non-empty and cannot be parsed as an i64.
  • it failed to execute git
  • git exited with non-zero status
  • git wrote stdout data that cannot be parsed as an i64.

Panics

Panics if git writes non-UTF bytes to stdout.