rljacobson / PillowData

Parse and analyze the data that the sleep tracking app Pillow exports.
MIT License
7 stars 0 forks source link

Minor documentation correction regarding timetamps #1

Open TomPlum opened 1 week ago

TomPlum commented 1 week ago

https://github.com/rljacobson/PillowData/blob/4128f398f0d766da4d91654ec607da1bd9c63c78/Parse%20Pillow%20Database.ipynb#L159

Hey, just wanted to clarify on the above comment in your notebook as I'm also writing some code to parse the raw database export in this repo.

With Pillow being an iOS app, it actually uses Apples own Cocoa Datetime API from their Core Data storage framework. Timestamps from this API are stored as seconds from January 1st 2001, unlike UNIX timestamps which used milliseconds from January 1st 1970 00:00 (Epoch).

I figured out that adding 31 years onto them corrected them... until I figured out why that was the case. This utility function of mine explains it (essentially since 2001 - 1970 = 31).

Not necessarily expecting you to correct your comment in the notebook, just more of an FYI 😄

rljacobson commented 1 day ago

Thanks for the correction! I'll leave this issue open for anyone else who might come by to read.