If I understand your problem correctly, your code should work, and also seems to
give the expected result when I try it. Perhaps it is an issue of systemTimeZone
versus localTimeZone
.
But note that you can simplify the complete method to
NSTimeInterval i = [date timeIntervalSince1970];
i -= [[NSTimeZone localTimeZone] secondsFromGMTForDate:date];