diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-11-19 18:38:30 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-11-19 18:38:30 -0500 |
commit | 198e0680822e2371bf256b0c39017bfe202f3e85 (patch) | |
tree | a3f8701adf8db93f5dcc953f99c9ebc4e514a59a | |
parent | 77b1df76882982016709b4d65ced0cf5673492e8 (diff) |
{crtsh,tls}-pem2html: use the timestamp of input for 'now'
-rw-r--r-- | crtsh-pem2html.go | 11 | ||||
-rw-r--r-- | 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"). </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 |