libvirt/scripts/meson-timestamp.py
Pavel Hrdina c98eac9c59 meson: docs: generate docs timestamp
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2020-08-03 09:27:06 +02:00

14 lines
322 B
Python
Executable File

#!/usr/bin/env python3
import os
from datetime import datetime, timezone
timestamp = os.environ.get('SOURCE_DATE_EPOCH', None)
timeformat = '%c %Z'
if timestamp:
print(datetime.fromtimestamp(int(timestamp), tz=timezone.utc).strftime(timeformat))
else:
print(datetime.now(tz=timezone.utc).strftime(timeformat))