From 277cfdefff7a48909e092ff16f6020ac7ddc7986 Mon Sep 17 00:00:00 2001 From: Eliot Whalan Date: Fri, 15 Jul 2016 12:39:20 +1000 Subject: [PATCH] Use parseduration --- assets/clone.html | 12 ++++++------ assets/index.html | 12 ++++++------ pastebin.go | 5 ++--- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/assets/clone.html b/assets/clone.html index 5857ed9..a9c118a 100644 --- a/assets/clone.html +++ b/assets/clone.html @@ -451,12 +451,12 @@ diff --git a/assets/index.html b/assets/index.html index 5ae2722..3d7ac55 100644 --- a/assets/index.html +++ b/assets/index.html @@ -450,12 +450,12 @@ diff --git a/pastebin.go b/pastebin.go index 60752e1..224d08d 100644 --- a/pastebin.go +++ b/pastebin.go @@ -14,7 +14,6 @@ import ( "io/ioutil" "log" "net/http" - "strconv" "time" // uniuri is used for easy random string generation @@ -108,9 +107,9 @@ func Sha1(paste string) string { // DurationFromExpiry takes the expiry in string format and returns the duration // that the paste will exist for func DurationFromExpiry(expiry string) time.Duration { - i, err := strconv.ParseInt(expiry, 10, 64) + duration, err := time.ParseDuration(expiry) Check(err) - return time.Hour * time.Duration(i) + return duration } // Save function handles the saving of each paste.