From b54a1c9686eec3c1114e9b58cb67679ba59c45bd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 14 Mar 2018 18:18:31 -0400 Subject: directories --- util/date.go | 51 --------------------------------------------------- util/html.go | 14 -------------- 2 files changed, 65 deletions(-) delete mode 100644 util/date.go delete mode 100644 util/html.go (limited to 'util') diff --git a/util/date.go b/util/date.go deleted file mode 100644 index 3b5c457..0000000 --- a/util/date.go +++ /dev/null @@ -1,51 +0,0 @@ -package util - -import ( - "html/template" - "time" -) - -func Date2HTML(t time.Time) template.HTML { - return template.HTML(t.Local().Format("")) -} - -func DateTime2HTML(t time.Time) template.HTML { - return template.HTML(t.Local().Format("")) -} - -func DateTime2ColorHTML(t time.Time) template.HTML { - return template.HTML(t.Local().Format("")) -} - -type TimeRange struct { - A, B time.Time -} - -func (tr TimeRange) ToPct(point time.Time) float64 { - dur_ab := tr.B.Sub(tr.A) - dur_ap := point.Sub(tr.A) - return float64(dur_ap) / float64(dur_ab) -} - -type ByteRange struct { - A, B byte -} - -func (br ByteRange) FromPct(pct float64) byte { - ab := int16(br.B) - int16(br.A) - ap := int16(pct * float64(ab)) - return byte(int16(br.A) + ap) -} - -func PctCap(pct float64) float64 { - if pct < 0 { - pct = 0 - } else if pct > 1 { - pct = 1 - } - return pct -} - -func MapRange(tr TimeRange, br ByteRange, t time.Time) byte { - return br.FromPct(PctCap(tr.ToPct(t))) -} diff --git a/util/html.go b/util/html.go deleted file mode 100644 index af2ce60..0000000 --- a/util/html.go +++ /dev/null @@ -1,14 +0,0 @@ -package util - -import ( - "html/template" - "strings" -) - -func HTMLCellEscapeString(s string) template.HTML { - html := template.HTMLEscapeString(s) - if strings.TrimSpace(html) == "" { - html = " " - } - return template.HTML(html) -} -- cgit v1.2.3-2-g168b