package processor import "log" // calcNeededTime accepts the start and the end of the recording time, converts the time from the format STRING to the // format INT and returns the hour and the minute of the start recording time, the hour and the minute of the end // recording time. func calcNeededTime(startTime, endTime string) (startHour, startMinute, endHour, endMinute int) { // Calc needed time. startHour, startMinute, err := partitionTime(startTime) if err != nil { log.Fatal("Ошибка конвертации: ", err) } endHour, endMinute, err = partitionTime(endTime) if err != nil { log.Fatal("Ошибка конвертации: ", err) } return startHour, startMinute, endHour, endMinute } ///////////////////////////////////////////////////////////////////////////////////// //// CalcEndMinuteFirstVideo calculates the need to change the hour (switching one fragment of video recording (which //// lasts 1 hour) to another fragment of video recording) and returns the number of hours (required number of video //// fragments), the duration of minutes (the object responsible for the indicator of minutes) of each fragment for the //// formation of the final video (except for the last video fragment, provided DurationHour > 0 (the third object //// returned by the CalcEndMinuteFirstVideo function)). //// //// In the case that you need to take a full fragment of the video file, for example, from 00-00 to 03-00, the //// DurationHour value is conciliated by 1 and returned. //func CalcEndMinuteFirstVideo(durationHour, endMinuteFirstVideo, startHour, endHour, endMinute int) ( // durationHourCalc int, endMinuteFirstVideoCalc int) { // durationHour = endHour - startHour // // if durationHour > 0 { // endMinuteFirstVideo = 60 // } else { // endMinuteFirstVideo = endMinute // } // // if endMinute == 0 && durationHour > 0 { // durationHour -= 1 // } // // return durationHour, endMinuteFirstVideo //}