Browse Source

Fix filewatch example

Use last modified time when the time is parsed without error. This prevents an
extra file read at start of watch for a connection.

Fixes #125.
Gary Burd 9 years ago
parent
commit
6b3d49710b
1 changed files with 1 additions and 1 deletions
  1. 1 1
      examples/filewatch/main.go

+ 1 - 1
examples/filewatch/main.go

@@ -120,7 +120,7 @@ func serveWs(w http.ResponseWriter, r *http.Request) {
 	}
 
 	var lastMod time.Time
-	if n, err := strconv.ParseInt(r.FormValue("lastMod"), 16, 64); err != nil {
+	if n, err := strconv.ParseInt(r.FormValue("lastMod"), 16, 64); err == nil {
 		lastMod = time.Unix(0, n)
 	}