[Re-adding #895737 to CC]
Hi Niels
> The attachment to the bug appears to be an empty file. Not sure if it
> is a bug in the BTS or you attached the wrong file.
No, my fault. Now attached.
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
diff --git a/asdf/asdf.py b/asdf/asdf.py
index a49265c..0247a27 100644
--- a/asdf/asdf.py
+++ b/asdf/asdf.py
@@ -6,6 +6,8 @@ from __future__ import absolute_import, division,
unicode_literals, print_functi
import datetime
import copy
import io
+import os
+import time
import re
import numpy as np
@@ -1031,9 +1033,13 @@ class AsdfFile(versioning.VersionedMixin):
elif software is not None:
software = Software(software)
+ time_ = datetime.datetime.utcfromtimestamp(
+ int(os.environ.get('SOURCE_DATE_EPOCH', time.time())),
+ )
+
entry = HistoryEntry({
'description': description,
- 'time': datetime.datetime.utcnow()
+ 'time': time_,
})
if software is not None:
diff --git a/docs/conf.py b/docs/conf.py
index 4d3e84d..77494e5 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -41,6 +41,13 @@ except ImportError:
# Load all of the global Astropy configuration
from astropy_helpers.sphinx.conf import *
+# Ensure documentation examples are determinstically random.
+import numpy
+try:
+ numpy.random.seed(int(os.environ['SOURCE_DATE_EPOCH']))
+except KeyError:
+ pass
+
# Get configuration information from setup.cfg
try:
from ConfigParser import ConfigParser