Esempio n. 1
0
// HTTP handler for /time.
func Time(w http.ResponseWriter, r *http.Request) {
	now := time.Now()
	zone, offset := now.Zone()
	t := timestamp{
		UTC:      now.UTC(),
		Local:    now.Local(),
		EPOCH:    now.Unix(),
		Offset:   float64(offset) / 60 / 60,
		Timezone: zone,
	}
	jsonxml.Write(w, r, t)
}
Esempio n. 2
0
// Status HTTP endpoint
func Status(w http.ResponseWriter, r *http.Request) {
	jsonxml.Write(w, r, getStatuses(jobs...))
}