// age = age in days, lastAge = age of last (more recent) file kept (also in days) sbool defaultAgeBasedBackupRetentionStrategy_shouldKeep(double age, double lastAge) { if (age <= 1/12.0) true; // keep all backups within last hour if (age <= 0.5 && age >= lastAge+1/12.0) true; // keep hourly backups within last 12 hours if (age <= 7 && age >= lastAge+1) true; // keep every daily backup from this week if (age <= 28 && age >= lastAge+7) true; // weekly backups for 3 more weeks if (age >= lastAge+365.0/12) true; // after 4 weeks, switch to monthly (roundabout) false; }