vectorscan/cmake/formatdate.py
Matthew Barr f06f5d0702 Use SOURCE_DATE_EPOCH for timestamp if present
The Debian reproducible builds effort suggests using
this environment variable for timestamps.
2016-08-10 15:14:30 +10:00

19 lines
354 B
Python
Executable File

#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import datetime
def usage():
print("Usage:", os.path.basename(sys.argv[0]), "<seconds from epoch>")
if len(sys.argv) != 2:
usage()
sys.exit(1)
ts = sys.argv[1]
build_date = datetime.datetime.utcfromtimestamp(int(ts))
print(build_date.strftime("%Y-%m-%d"))