     return !bools.filter { $0 }.isEmpty
 }
 
-func systemClock() -> NSTimeInterval {
+func systemClock() -> Double {
     return NSDate().timeIntervalSince1970
 }
 

        return 1
    }
    
    func cost(a: Action) -> Int {
        switch a {
        case .Meta(let i):
            return meta(i)

    var mayGo = false
    var updated = false
    
    func setMeters(newList: [MeterData]) {
        var olds = [String:Meter]()
        for m in meters {
            olds[m.name] = m
        }
        var news = [String:MeterData]()
        for m in newList {
            news[m.name] = m
        }
        var keys = [String:Int]()
        for k in olds.keys {
            keys[k] = 1
        }
        for k in news.keys {
            keys[k] = 1
        }
        for k in keys.keys {
            if let n = news[k] {
                if olds[k] == nil {
                    olds[k] = Meter(app: self, name: k)
                }
                n.copyTo(olds[k]!)
            }
            else {
                olds.removeValueForKey(k)
            }
        }
        meters = newList.map { olds[$0.name]! }
    }
    
    func storeState() {
        if updated {
            let parts = map(meters) { "\($0.name) \($0.actionCost) \($0.firstActed ?? 0)" } + ["\(lastActed)"]
            let data = ",".join(parts)
            updated = !state.put(data)
        }
    }
    
    func loadState() -> Bool {
        let data = ""
        var parts = split(data) { $0 == "," }.map { split($0) { $0 == " " } }
        lastActed = (parts.removeLast()[0] as NSString).doubleValue
        return true
    }

    func configure() {
        setMeters([MeterConf(name: "s", actionLimit: nil, timeLimit: 60, restTime: 60), MeterConf(name: "m", actionLimit: nil, timeLimit: 420, restTime: 900)])
    }

    init(clock: (() -> Double), makeFile: ((path: String?, mode: String) -> File), root: String?, errors: [String]) {
        self.clock = clock
        self.errors = errors
        let s = NSUUID().UUIDString
