Question

I am using the FSEvents API to get all the changes in a directory from its creation until now.

From the way I am doing it, I successfully get all the event ids, however these events do not contain timestamps. At the beginning I thought it was impossible to match these ids with a specific time until I read this on CocoaDev:

Events are given a unique 64-bit ID rather than a timestamp (due to automatic coalescing of events that occur within 30 seconds of each other to save space) but you can convert this to an approximate time.

However I still do not understand how to convert 16738189 to a timestamp. Any ideas?

No correct solution

OTHER TIPS

My guess is that you don't convert it to a timestamp. It says "you can convert this to an approximate time." In your event handler, you know the current time when you get called. Since events are coalesced, you could mark the first one with the time when the event handler is called, and mark the subsequent events with some delta from the previous one. So long as the sum of the deltas are less than the coalescing time (30 seconds in this case?), you shouldn't have any that have the same time.

I am pretty sure that the way that the API is used is that you ask the system to replay all events after a time or id, you rather than worrying about the time of a particular event, you just know they are complete and in order.

if it is an approximate time you could try converting it to a time based on seconds since unix epoch, which that API uses rather than the more typical OS X time of jan 1 2001

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top