You'll probably be happier working completely in Cocoa for this problem, using NSDate instead of CFAbsoluteTime.
Applicable document is the Date and Time Programming Guide.
The general approach you'll need is to work within an NSCalendar
, which encapsulates all of the information about days per month, months per year, leap years, DST changes, all for a particular time zone. Convert your NSDate
instances to NSDateComponent
and you'll be able to extract the day and month numbers, then bucketize from there.
Remember that the function you write (return a count when given a date) will implicitly or explicitly have to handle NSCalendar and NSTimeZone values. The answer will vary by year (is it a leap year? does the interval include a leap day) and locale/date (are we observing Daylight Saving Time in this location right now?).