Firefox team announced changing their "Rapid release" plan.
- https://blog.mozilla.org/futurereleases/2012/09/24/firefox-schedule-changes-around-year-end/
- https://wiki.mozilla.org/RapidRelease/Calendar
module FirefoxReleaseDate =
let calculateIn version =
let calculateAddDays (currentDate:System.DateTime) =
let happyHoliday = new System.DateTime(currentDate.Year, 12, 25)
match ( (happyHoliday.Year >= 2012), (happyHoliday <= currentDate.AddDays(7.0 * 6.0)) ) with
| (true, true) -> currentDate.AddDays(7.0 * 7.0)
| _ -> currentDate.AddDays(7.0 * 6.0)
let rec nextFirefoxReleaseDate (currentDate:System.DateTime) (currentVersion) =
match currentVersion with
| currentVersion when currentVersion >= version -> currentDate
| _ -> nextFirefoxReleaseDate (calculateAddDays(currentDate)) (currentVersion + 1)
let ver5ReleaseDate = new System.DateTime(2011, 6, 21)
match version with
| version when version >= 7 -> nextFirefoxReleaseDate (ver5ReleaseDate.AddDays(7.0 * 8.0)) 6
| 6 -> ver5ReleaseDate.AddDays(7.0 * 8.0)
| 5 -> ver5ReleaseDate
| _ -> printfn "Not supported."; ver5ReleaseDate
let calculateFirefoxYear =
let rec incrementFirefoxYear (n:int) =
let date = calculateIn(n)
if n < date.Year
then incrementFirefoxYear (n+1)
else (n, date)
incrementFirefoxYear(5)
let result = FirefoxReleaseDate.calculateFirefoxYear
let firefoxYearVersion = fst result
let firefoxYearDate = snd result
System.Console.WriteLine("The version equals release year ({0}) ({1:d})", firefoxYearVersion, firefoxYearDate)
System.Console.WriteLine("The version passes release year ({0}) ({1:d})", firefoxYearVersion+1, FirefoxReleaseDate.calculateIn(firefoxYearVersion+1))
No comments:
Post a Comment