Fix 1 day offset for enuemrateDates
This commit is contained in:
BIN
backup-manager
BIN
backup-manager
Binary file not shown.
6
main.go
6
main.go
@@ -99,12 +99,10 @@ func getDir(path string, filter string) ([]string, []time.Time) {
|
||||
name = path + "/" + file.Name()
|
||||
names = append(names, name)
|
||||
dates = append(dates, workingDate)
|
||||
log.Printf("%v found\n", workingDate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Printf("%s: %v\n", path, dates)
|
||||
return names, dates
|
||||
}
|
||||
|
||||
@@ -123,16 +121,14 @@ func backupToday(timeToday time.Time, config Config, host Host) {
|
||||
func findBackupDate(dates []time.Time, findDate time.Time) int {
|
||||
for i, date := range(dates) {
|
||||
if date == findDate {
|
||||
log.Printf("%v found", date)
|
||||
return i
|
||||
}
|
||||
}
|
||||
log.Printf("%v not found", findDate)
|
||||
return 0
|
||||
}
|
||||
|
||||
func enumerateDates(dates []time.Time, currDate time.Time, searchDayNum int) bool {
|
||||
for i:=1; i<=searchDayNum; i++ {
|
||||
for i:=1; i<searchDayNum; i++ {
|
||||
for _, date := range(dates) {
|
||||
if currDate.Add(-time.Hour * time.Duration(24 * i)) == date {
|
||||
log.Printf("Existing backup exists at %v\n", date)
|
||||
|
||||
Reference in New Issue
Block a user