             let site = Site(url: "http://s\(0)ite\(0)/foo", title: "A \(0)")
             site.guid = "abc\(0)def"
             for i in 0...20 {
-                addVisitForSite(site, intoHistory: history, from: .Local, atTime: advanceTimestamp(1439088398461, by: 1000 * i))
+                addVisitForSite(site, intoHistory: history, from: .Local, atTime: advanceTimestamp(baseInstantInMicros, by: 1000000 * i))
             }
             return succeed()
         }

    case Remote
}

private func populateHistoryForFrecencyCalcuations(history: SQLiteHistory, siteCount count: Int) {
    for i in 0...count {
        let site = Site(url: "http://s\(i)ite\(i)/foo", title: "A \(i)")
        site.guid = "abc\(i)def"

        history.insertOrUpdatePlace(site.asPlace(), modified: 1234567890).value
        for j in 0...20 {
            let visitTime = advanceMicrosecondTimestamp(1437088398461000, by: ((1000000 * i) + (1000 * j)))
            addVisitForSite(site, intoHistory: history, from: .Local, atTime: visitTime)
            addVisitForSite(site, intoHistory: history, from: .Remote, atTime: visitTime)
        }
    }
}

private func addVisitForSite(site: Site, intoHistory history: SQLiteHistory, from: VisitOrigin, atTime: Timestamp) {
    let visit = SiteVisit(site: site, date: atTime, type: VisitType.Link)
    switch from {
    case .Local:

        let count = 500

        history.clearHistory().value
        populateHistoryForFrecencyCalculations(history, siteCount: count)

        history.setTopSitesNeedsInvalidation()
        self.measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: true) {
