Modified date on android devices: Possible solution?

Discuss new features and functions
HiPerFreak
Posts: 7
Joined: 11 Dec 2018

Post by HiPerFreak • 11 Dec 2018, 10:05

Helle everybody,

thank you very much for this great piece of software!

When syncing files with my Android 6 HTC device, I get the error message "SetValues failed for WPD_OBJECT_DATE_MODIFIED (0x80070005, Access is denied)", and of course when I check the modification date it is set to the current date time.

BUT: When I copy the same file with the windows explorer, the modification date of the new file is correctly set to the original date! So obviously there seems to exist a way/an API to correctly set the modification date at least for new files (updating could be workarounded by deleting and recreating).

So I really wonder if you have investigated this way of doing it...

For me, the modification date is essential, because the HTC photo gallery app orders my pictures by modification date (and this cannot be changed), and when I do a sync, the sequence of the pictures is completely messed up... :(

I would really love to hear your opinion on this point!!!

Best regards,
Daniel

User avatar
Zenju
Site Admin
Posts: 4955
Joined: 9 Dec 2007

Post by Zenju • 16 Dec 2018, 13:11

Here's a link to an old FreeFileSync version that uses a strategy probably similar to what Explorer is doing (= it sets modTime right during file creation instead of afterwards). Does this correctly set modification times on your Android?
https://www.mediafire.com/file/3iavwthq3je7gao/FreeFileSync_8.10_Windows_Setup.exe

HiPerFreak
Posts: 7
Joined: 11 Dec 2018

Post by HiPerFreak • 17 Dec 2018, 13:06

Hi Zenju, thank you very much for your answer!! Yes, this version does set the modification date correctly when "adding a new file" and when "updating a file" on the android device (just tested with a single file).

I would really love to see an option to choose the copy method in the "Synchronization Settings" dialog!

User avatar
Zenju
Site Admin
Posts: 4955
Joined: 9 Dec 2007

Post by Zenju • 29 Dec 2018, 14:28

Here's the final implementation that will be in the next release. Please let me know if there are any issues. I've changed the behavior when setting modification time to do so already during file creation. This will solve the issues with your Android version 6 (I couldn't reproduce it with the newer Android 8.1, but your version is still quite widespread).
https://www.mediafire.com/file/tn0en5oybtaoay9/FreeFileSync_10.8_%5BBeta%5D_Windows_Setup.exe/file

iBeta
Posts: 2
Joined: 30 Dec 2018

Post by iBeta • 30 Dec 2018, 17:35

Had the same problem, the 10.8 beta version appeared to fix it - the android files showed the correct timestamps in windows explorer. However looking directly at the files via the phone, the timestamps were reset.
Samsung Galaxy S9+ (Android 8) <-> Windows 7 x64.
Edit - Also tried with v8.10. Again all device files are timestamped with current time.

User avatar
Zenju
Site Admin
Posts: 4955
Joined: 9 Dec 2007

Post by Zenju • 31 Dec 2018, 09:07

@iBeta: Thanks for your testing! It seems the new version has also "solved" a different issue of time stamps not being preserved. Still a bit surprising that there is a difference in this regard between the old FFS 8.10 and the 10.8 beta.

mehcoj
Posts: 3
Joined: 1 Jan 2019

Post by mehcoj • 01 Jan 2019, 12:56

Hi and happy new year,
I have now the same issue when sync about 100GB using a windows 10 notebook on a Synology DiskStation (linux based) to an remoted attached USB Drive (to the DiskStation). The modified time was set to the creation time or during the next run to the current time. Not all files are handled in that way but I can not find a rule. Running the sync again some more files are correct, but most of the files are wrong. I using the new beta 10.8 after found this post.

Any ideas?

regards, Mehcoj

User avatar
Zenju
Site Admin
Posts: 4955
Joined: 9 Dec 2007

Post by Zenju • 01 Jan 2019, 13:00

mehcoj wrote:
01 Jan 2019, 12:56
Hi and happy new year,
I have now the same issue when sync about 100GB using a windows 10 notebook on a Synology DiskStation (linux based) to an remoted attached USB Drive (to the DiskStation). The modified time was set to the creation time or during the next run to the current time. Not all files are handled in that way but I can not find a rule. Running the sync again some more files are correct, but most of the files are wrong. I using the new beta 10.8 after found this post.

Any ideas?

regards, Mehcoj
This is unrelated to the MTP issue discussed above. For your problem, see: https://freefilesync.org/faq.php#different-after-sync

mehcoj
Posts: 3
Joined: 1 Jan 2019

Post by mehcoj • 01 Jan 2019, 13:55

@zenju:

thx for clarification and for the quick response...

But still have the issue and can not find a process running on the synology diskstation that change the datetime stamp back. Using the sync over the networking from the notebook to the diskstation everything works fine. But syncing foreword to the attached usb drive from the diskstation causes that problem.

When I use the windows explorer and copy the files manually from the diskstation to the attached usb drive that modification datetime stay unmodified.

Regards, mehcoj

User avatar
Zenju
Site Admin
Posts: 4955
Joined: 9 Dec 2007

Post by Zenju • 01 Jan 2019, 14:07

mehcoj wrote:
01 Jan 2019, 13:55
But still have the issue and can not find a process running on the synology diskstation that change the datetime
Probably not on the diskstation, but on your local PC. If you send me a Process Monitor trace I can have a look.

mehcoj
Posts: 3
Joined: 1 Jan 2019

Post by mehcoj • 01 Jan 2019, 14:55

many many thanks for your support and sorry for my bad English. I’m from Germany. I send the file per mail.

HiPerFreak
Posts: 7
Joined: 11 Dec 2018

Post by HiPerFreak • 01 Jan 2019, 19:41

Zenju wrote:
29 Dec 2018, 14:28
Here's the final implementation that will be in the next release. Please let me know if there are any issues. I've changed the behavior when setting modification time to do so already during file creation. This will solve the issues with your Android version 6 (I couldn't reproduce it with the newer Android 8.1, but your version is still quite widespread).
https://www.mediafire.com/file/tn0en5oybtaoay9/FreeFileSync_10.8_%5BBeta%5D_Windows_Setup.exe/file
Hi Zenju,

thank you very much for your efforts. I tried this version with my Android 6 just now, and I am still getting the warning "Setting the modification time silently ignored by the device.", but it nevertheless correctly sets the modification date (same with "Fail-safe file copy" checked or unchecked).

On my Android 8 from Huawei, I couldn't find any way to transfer a modification date. Even with Explorer it doesn't work... :(

Best regards,
Daniel

User avatar
Zenju
Site Admin
Posts: 4955
Joined: 9 Dec 2007

Post by Zenju • 01 Jan 2019, 20:12

HiPerFreak wrote:
01 Jan 2019, 19:41
I tried this version with my Android 6 just now, and I am still getting the warning "Setting the modification time silently ignored by the device.", but it nevertheless correctly sets the modification date
MTP is such a mess, but we're still making progress. Since MTP silently ignores errors to set the modification time, FFS does an explicit check if it worked, and this checked failed for inconceivable reasons when, as you report, the mod time is in fact correct when you check manually. I'm not sure what to make of this, maybe just another MTP quirk. Anyway, the error message above isn't great, so I've added the actual modification times involved, which could give some further insights: https://www.mediafire.com/file/oss91x06ec3rfcf/FreeFileSync_10.8_%5BBeta%5D_Windows_Setup.exe

HiPerFreak
Posts: 7
Joined: 11 Dec 2018

Post by HiPerFreak • 01 Jan 2019, 20:40

Hi Zenju,

the problem seems to be that the explicit check does not consider the "Ignore time shift" setting (set to 1 and 2 in my case). The detailed error message was "Setting the modification time (13.11.2018 11:08:50) was silently ignored by the device (13.11.2018 10:08:50)."

Thank you for your efforts and the very fast response.

jmsxl
Posts: 15
Joined: 5 Oct 2018

Post by jmsxl • 02 Jan 2019, 16:46

I just want to say Thank You for continuing to work around the poorly implemented MTP. FFS's support of MTP is really good, in the face of such a botched protocol extension.

User avatar
Zenju
Site Admin
Posts: 4955
Joined: 9 Dec 2007

Post by Zenju • 03 Jan 2019, 10:26

HiPerFreak wrote:
01 Jan 2019, 20:40
the problem seems to be that the explicit check does not consider the "Ignore time shift" setting (set to 1 and 2 in my case). The detailed error message was "Setting the modification time (13.11.2018 11:08:50) was silently ignored by the device (13.11.2018 10:08:50)."
So when you say "it nevertheless correctly sets the modification date" you actually mean "with an 1 hour offset"!? Or is this offset only shown in the warning message above, but not detectable when you compare file times (with FreeFileSync) after the sync?

HiPerFreak
Posts: 7
Joined: 11 Dec 2018

Post by HiPerFreak • 03 Jan 2019, 11:36

Sorry for being unclear, I mean it is set with an 1 hour offest (as expected due to MTP and file system...).

User avatar
Zenju
Site Admin
Posts: 4955
Joined: 9 Dec 2007

Post by Zenju • 03 Jan 2019, 12:05

HiPerFreak wrote:
03 Jan 2019, 11:36
Sorry for being unclear, I mean it is set with an 1 hour offest (as expected due to MTP and file system...).
Is this offset also visible in FreeFileSync's "date" columns after sync and comparing again?

HiPerFreak
Posts: 7
Joined: 11 Dec 2018

Post by HiPerFreak • 03 Jan 2019, 14:00

Yes it is, I have attached a screenshot (left side computer, right side android):
ffs_screenshot.jpg
If I enter 1,2 into the "ignore time shift" filed, comparison shows no changes to sync.
You do not have the required permissions to view the files attached to this post.

User avatar
Zenju
Site Admin
Posts: 4955
Joined: 9 Dec 2007

Post by Zenju • 03 Jan 2019, 20:52

HiPerFreak wrote:
03 Jan 2019, 14:00
Yes it is, I have attached a screenshot (left side computer, right side android):
ffs_screenshot.jpg
Thanks for the clarification, so at least FFS's explicit check after sync is working as expected. The fact that Android 6 changes the input time by some offset is a quirk that I cannot reproduce on Android 8.1. But then again, Android 8.1 seems to "forget" any modification times when the USB cable is disconnected and reconnected again, which is an even bigger screw up. Still, it seems FFS 10.8's behavior regarding MTP is now probably as good as it can get considering MTP's limitations.

iBeta
Posts: 2
Joined: 30 Dec 2018

Post by iBeta • 03 Jan 2019, 22:41

For me, the time is immediately reset to current on the Android 8 device files. The pc has no firewall, and Windows Indexing is disabled.
Are you saying it is not possible to prevent the time modification on the device files, due to MTP. If so, will it not be fixed in Android 9?

HiPerFreak
Posts: 7
Joined: 11 Dec 2018

Post by HiPerFreak • 04 Jan 2019, 00:47

Zenju wrote:
03 Jan 2019, 20:52
Thanks for the clarification, so at least FFS's explicit check after sync is working as expected. The fact that Android 6 changes the input time by some offset is a quirk that I cannot reproduce on Android 8.1. But then again, Android 8.1 seems to "forget" any modification times when the USB cable is disconnected and reconnected again, which is an even bigger screw up. Still, it seems FFS 10.8's behavior regarding MTP is now probably as good as it can get considering MTP's limitations.
In my opinion it would be more consistent, if the date check after copying behaves the same way as the check when doing the "Compare" operation. This means that if I have set the "Ingore time shift" field to "1,2" the warning should not appear if the dates differ only by exactly one or two hours. That's what this setting is for after all, right (i.e. a workaround for the problem with different time zones, as far as I could defer from the documentation)?

User avatar
Zenju
Site Admin
Posts: 4955
Joined: 9 Dec 2007

Post by Zenju • 04 Jan 2019, 09:34

iBeta wrote:
03 Jan 2019, 22:41
Are you saying it is not possible to prevent the time modification on the device files, due to MTP.
If so, will it not be fixed in Android 9?
If Google really wanted, they'd have fixed this age-old "bug" regarding not accepting modification times long ago.

HiPerFreak wrote:
04 Jan 2019, 00:47
In my opinion it would be more consistent, if the date check after copying behaves the same way as the check when doing the "Compare" operation. This means that if I have set the "Ingore time shift" field to "1,2" the warning should not appear if the dates differ only by exactly one or two hours. That's what this setting is for after all, right (i.e. a workaround for the problem with different time zones, as far as I could defer from the documentation)?
MTP returning a different time than what was set only milliseconds before is simply yet another "bug" and has nothing to do with time zones or daylight saving time. OTOH there's nothing the user can do about it, so it would be nice if this particular warning was ignored when "Ignore time shift" is set. However it seems simply permanently ignoring the warning is a good enough solution.