tmo1 / sms-ie

SMS Import / Export is a simple Android app that imports and exports SMS and MMS messages, call logs, and contacts from and to JSON / NDJSON files.
GNU General Public License v3.0
319 stars 38 forks source link

date in MMS in seconds instead of milliseconds #143

Closed jringbox closed 6 months ago

jringbox commented 7 months ago

From another phone, I sent myself a photo with no message. This is the contents of the JSON.

{
  "_id":"312",
  "thread_id":"389",
  "date":"1701990508",
...
"__parts":[{"_id":"227","mid":"312","seq":"0","ct":"image\/jpeg","name":"123_1.jpeg","cl":"123_1.jpeg",
"_data":"\/data\/user_de\/0\/com.android.providers.telephony\/app_parts\/PART_1701990513800_123_1.jpeg"}]
}

The date is in seconds instead of milliseconds. The attachment date (1701990513800) in the attached jpeg is a correctly formatted epoch. All SMS message I found appear to be milliseconds for the date of the message. This MMS is in seconds. Is there a bug in the code or is there a rule where I'm suppose to multiply the value by 1000 to get milliseconds?

Version used: 2.3.0 with the ndjson format

tmo1 commented 7 months ago

SMS I/E does no processing or conversion of any dates - it simply reads them (as strings) from the Android databases, and writes them out as JSON. It seems that for some reason, Android stores MMS dates in seconds rather than milliseconds. I can't find much discussion of this, but I did find an explicit acknowledgement of the fact in a comment to the Android source code:

// NOTE: The field Mms.DATE is stored in seconds, not milliseconds.

So yes, I suppose you'd have to multiply by 1000 to convert to milliseconds.

jringbox commented 7 months ago

Interesting. Looks like they were trying to query content within that second for the MMS. I guess the datastore doesn't keep the milliseconds which is why they had to do that. Bummer. Strange how they decided to design it that way.