From 198e0680822e2371bf256b0c39017bfe202f3e85 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 19 Nov 2016 18:38:30 -0500 Subject: {crtsh,tls}-pem2html: use the timestamp of input for 'now' --- crtsh-pem2html.go | 11 ++++++++++- tls-pem2html.go | 11 ++++++++++- 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"). `)) -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"). `)) -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 -- cgit v1.2.3-2-g168b