Daytime Handler
package daytime
import (
"io"
"log"
"time"
)
func formatResponse(t time.Time) []byte {
return []byte(t.Format("Monday, January 2, 2006 15:04:05-MST\r\n"))
}
func Handler(connection io.ReadWriteCloser) error {
defer connection.Close()
_, err := connection.Write(formatResponse(time.Now()))
if err != nil {
log.Print("Error writing date:", err)
}
return err
}