> NSDate (and dates/timestamps in general) is a poor choice for Strideable, 
> because, DST.
> A Calendar using this interface for a repeating event would be broken using 
> this. Or you would break anyone who really wants to iterate every fixed 86400 
> seconds.

Sometimes you want to add an interval of time according to the user’s clock; 
NSTimeInterval/NSDate math will do the wrong thing there. But sometimes you 
just want to get an NSDate thirty seconds from now, and for all you care the 
user can fly to Timbuktu during that time. That’s the sort of thing I’m using 
this for:

        // Don’t add to undo manager if we’re too close to the last change
        guard now - lastChangeDate > undoCoalescingTimespan else { return } 

It is simply not the case that *all* arithmetic on NSDates is incorrect unless 
it involves NSCalendar and NSDateComponents.

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

Reply via email to