Posts

Post marked as solved
2 Replies
I did manage to gets as accurate as nanoseconds using a uint64_t value by getting an NSDate * with timeIntervalSince1970 multiplied by 1000000000. I did testing it by calling [NSDate date] 9 times in a row, confirm that interval between call are around 2-3 microseconds on a device with a old Apple A4 chip. I did run the same test on a recent device with an Apple A15 chip and calling [NSDate date] 15 times in a row, returns many times similars values. But time precision still arround 1,2 microsecond when change occurs. So, using microseconds, as timestamp is possible with a uint64_t value. But using it to uniquely identify an element on a DBase required a bit more work then relying on just doing another [NSDate date] call. A uint64_t value can hold up to 0,1 nanosecond value. Not more (multiplying timeIntervalSince1970 by 10,000,000,000 is the maximum). Use @"..NSDate is: %llu" in a NSLog to show uint64_t value. So using a microsecond values as timestamp seams to be the right one to use.