Fixed timestamp processing on newer macOS/iOS releases.
authorRyan C. Gordon <icculus@icculus.org>
Sat, 20 Jul 2019 03:54:00 -0400
changeset 52 74a684017513
parent 51 baf247407cd9
child 53 84383f2688d4
Fixed timestamp processing on newer macOS/iOS releases.
archive_imessage.pl
--- a/archive_imessage.pl	Sun Jan 01 01:30:08 2017 -0500
+++ b/archive_imessage.pl	Sat Jul 20 03:54:00 2019 -0400
@@ -934,6 +934,12 @@
     my ($idname, $msgid, $text, $service, $account, $handle_id, $subject, $date, $is_emote, $is_from_me, $was_downgraded, $is_audio_message, $cache_has_attachments) = @row;
     next if not defined $text;
 
+    # This is probably from after Apple moved from seconds to nanoseconds
+    #  (High Sierra and equivalent iOS releases).
+    if ($date > 99999999999) {
+        $date /= 1000000000;
+    }
+
     # Convert from Cocoa epoch to Unix epoch (2001 -> 1970).
     $date += 978307200;