Modification time of file as shown by
stat in Linux for files copied from Android via usb is effected by changing of time zone setting on Android after file was created.
- Boot Ubuntu 20.4 (or Linux Mint 21) from live USB.
- On Android (I had version 11, also observed the effect for 9) set datetime and time zone to manual, put in offline mode.
- Connect Android to Linux via usb.
- Pick a file on Android, copy via file manager to location_1 on Linux.
staton copied file (one in location_1).
- Disconnect usb (important).
- Change time zone on Android by several hours.
- Reconnect usb.
- Copy same file from Android to location_2.
staton copied file (one in location_2).
- Observe difference on line with
Modifyof several hours.
There was a question asked in 2013 How do I transfer files between Android and Linux over USB?. Updated answer dated 2018 states that mtp works:
it seems most Linux distros are now working with MTP fairly well. I know in my experience, Mint (Ubuntu based) works out of the box
Indeed I connect device via USB, click in Nemo (GUI) on an icon, storage mounts and I can transfer files in GUI.
However I just noted time zone matters. When I change time zone on a phone files modification times change. And copied to Linux, they remain with those times and Linux time zone (per
stat), regardless of device's time zone, so files' "original" (phone's) time zone correction info is just lost. IMO not a desired effect, albeit rarely manifested as usually devices in close physical proximity have same time zone set.
Does that effect is due to how
mtp works or it might depend on something else? Any advice how to copy with correct times w/out making sure both devices have same time zone set at the time of copying files? TIA
P.S. I think I want to report a bug, but not sure where: Mint, Ubuntu, Debian, kernel, else?
A file on Android with time zone +1, Linux time zone +1
Android modification time as seen in both Android file manager and mtp mount in Linux Mint 21 based system in Nemo, say: 9:45:00.
After copy to ext4 fs
stat shows for
Change time zone on Android to +3 (maybe unmount/replug usb/remount just in case), copy same file to other location on ext4,
Change time zone on Linux to +3. For second copy
Note: when time zones are selected via GUI by city (I don't know other way in my Linux BTW) due to possibility of date savings results might differ even more or less by one hour.