1 files changed, 9 insertions(+), 6 deletions(-)

M main.go
M main.go +9 -6
@@ 22,6 22,7 @@ func init() {
 }
 
 type Result struct {
+	Timestamp time.Time
 	Duration time.Duration
 	Error    error
 }

          
@@ 49,10 50,11 @@ func worker(
 		err = driver.Get(url)
 		var d = time.Since(n)
 
+		logger.Println("request took", d - (d % time.Millisecond))
 		if err != nil {
-			output <- Result{Duration: d, Error: err}
+			output <- Result{Timestamp: n, Duration: d, Error: err}
 		} else {
-			output <- Result{Duration: d}
+			output <- Result{Timestamp: n, Duration: d}
 		}
 	}
 	driver.Quit()

          
@@ 117,7 119,6 @@ func main() {
 	//
 	go func() {
 		http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
-			var start = time.Now()
 			// Write file size first
 			var written, err = fmt.Fprintf(w, "Size: %d\n", size)
 			if err != nil {

          
@@ 141,7 142,6 @@ func main() {
 				}
 				left -= n
 			}
-			logger.Println("handled request in ", time.Since(start))
 		})
 
 		log.Fatal(http.ListenAndServe(listen, nil))

          
@@ 172,8 172,11 @@ func main() {
 			logger.Println("Worker errored: ", o.Error.Error())
 			e = o.Error.Error()
 		}
-		writer.Write([]string{e, fmt.Sprintf("%d", o.Duration / time.Millisecond)})
+		writer.Write([]string{
+			o.Timestamp.Format(time.RFC3339),
+			e,
+			fmt.Sprintf("%d", o.Duration / time.Millisecond),
+		})
 		writer.Flush()
-		logger.Println("request took ", o.Duration)
 	}
 }