From 683e11c27d12d449371c5b4e9087891ea3bd56ca Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 29 Oct 2012 19:53:48 -0700 Subject: [PATCH] expose the time object to allow custom formatting ref - http://bugs.activestate.com/show_bug.cgi?id=96009 --- tail.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tail.go b/tail.go index 4dfa2b4..039ae9a 100644 --- a/tail.go +++ b/tail.go @@ -12,7 +12,7 @@ import ( type Line struct { Text string - UnixTime int64 + Time time.Time } type Config struct { @@ -150,7 +150,7 @@ func (tail *Tail) tailFileSync() { if err == nil { if line != nil { - now := getCurrentTime() + now := time.Now() if tail.MaxLineSize > 0 && len(line) > tail.MaxLineSize { for _, line := range partitionString(string(line), tail.MaxLineSize) { tail.Lines <- &Line{line, now} @@ -213,11 +213,6 @@ func (tail *Tail) tailFileSync() { } } -// getCurrentTime returns the current time as UNIX timestamp -func getCurrentTime() int64 { - return time.Now().UTC().Unix() -} - // partitionString partitions the string into chunks of given size, // with the last chunk of variable size. func partitionString(s string, chunkSize int) []string {