     var lf = NSFileHandle(forWritingAtPath: fname)
     currentTicker = tickers[i]
     while currentStart > sinceTS {
+        let begin = NSDate().timeIntervalSinceReferenceDate
         reqComplete = false
         let localStart = currentStart
         currentStart = -1

var barsize = "5 mins"
var unixts = 1
var duration = "10800 S" // 3 hours
var outputDir: String = NSFileManager.defaultManager().currentDirectoryPath

let now = NSDate(timeIntervalSinceNow: 0)

            }
            file.synchronizeFile()
        }
        println("(sleep for \(sleepInterval) secs)...")
        NSThread.sleepUntilDate(NSDate(timeIntervalSinceReferenceDate: begin + sleepInterval))
    }
    if lf != nil {
        lf?.closeFile()
