From 56af7e99a819758c6bedc6d745a9f810f3fc050d Mon Sep 17 00:00:00 2001 From: Gogs Date: Wed, 19 Mar 2014 21:57:55 +0800 Subject: fork render --- modules/base/template.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'modules/base/template.go') diff --git a/modules/base/template.go b/modules/base/template.go index db79340e..23d3d277 100644 --- a/modules/base/template.go +++ b/modules/base/template.go @@ -6,7 +6,9 @@ package base import ( "container/list" + "fmt" "html/template" + "time" ) func Str2html(raw string) template.HTML { @@ -40,6 +42,9 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{ "AppDomain": func() string { return Domain }, + "LoadTimes": func(startTime time.Time) string { + return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms" + }, "AvatarLink": AvatarLink, "str2html": Str2html, "TimeSince": TimeSince, -- cgit v1.2.3