summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-11-19 18:38:30 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-11-19 18:38:30 -0500
commit198e0680822e2371bf256b0c39017bfe202f3e85 (patch)
treea3f8701adf8db93f5dcc953f99c9ebc4e514a59a
parent77b1df76882982016709b4d65ced0cf5673492e8 (diff)
{crtsh,tls}-pem2html: use the timestamp of input for 'now'
-rw-r--r--crtsh-pem2html.go11
-rw-r--r--tls-pem2html.go11
2 files changed, 20 insertions, 2 deletions
diff --git a/crtsh-pem2html.go b/crtsh-pem2html.go
index 957e23a..63249c3 100644
--- a/crtsh-pem2html.go
+++ b/crtsh-pem2html.go
@@ -104,7 +104,16 @@ var tmpl = template.Must(template.New("pem2html").
</html>
`))
-var now = time.Now()
+func getNow() time.Time {
+ stat, err := os.Stdin.Stat()
+ if err == nil {
+ return stat.ModTime()
+ } else {
+ return time.Now()
+ }
+}
+
+var now = getNow()
type interpolation struct {
ta, tb time.Time
diff --git a/tls-pem2html.go b/tls-pem2html.go
index f38ab5f..50d5104 100644
--- a/tls-pem2html.go
+++ b/tls-pem2html.go
@@ -105,7 +105,16 @@ var tmpl = template.Must(template.New("pem2html").
</html>
`))
-var now = time.Now()
+func getNow() time.Time {
+ stat, err := os.Stdin.Stat()
+ if err == nil {
+ return stat.ModTime()
+ } else {
+ return time.Now()
+ }
+}
+
+var now = getNow()
type interpolation struct {
ta, tb time.Time