func ExtractTime(file string) (*time.Time, error) {
	// This must match the motion.conf format.
	const shortForm = "20060102150405"

	_, filename := filepath.Split(file)

	exploded := strings.Split(filename, "-")

	if len(exploded) != 3 || len(exploded[1]) != 14 {
		now := time.Now().UTC()
		return &now, errors.New("Invalid file name, defaulting to UTC timestamp")
	}

	t, err := time.Parse(shortForm, exploded[1])
	if err != nil {
		return nil, err
	}
	return &t, nil
}
// ExtractTime returns the UTC time from the filepath
ExtractTime returns the UTC time from the filepath
// ExtractTime returns the UTC time from the filepath
func ExtractTime(file string) (*time.Time, error) {
	const shortForm = "20060102150405"
	_, filename := filepath.Split(file)
	exploded := strings.Split(filename, "-")
	if len(exploded) != 3 || len(exploded[1]) != 14 {
		now := time.Now().UTC()
		return &now, errors.New("Invalid file name, defaulting to UTC timestamp")
	}
	t, err := time.Parse(shortForm, exploded[1])
	if err != nil {
		return nil, err
	}
	return &t, nil
}
func ExtractTime ( file string ) ( * time . Time , error ) { const shortForm = " " _ , filename := filepath . Split ( file ) exploded := strings . Split ( filename , " " ) if len ( exploded ) != 3 || len ( exploded [ 1 ] ) != 14 { now := time . Now ( ) . UTC ( ) return & now , errors . New ( " " ) } t , err := time . Parse ( shortForm , exploded [ 1 ] ) if err != nil { return nil , err } return & t , nil }
ExtractTime returns the UTC time from the filepath
ExtractTime returns the UTC time from the filepath
// This must match the motion.conf format.