1

I recorded a video with my camera and when I open the directory containing the video files, the modified time is always wrong.

Here is a screenshot from the video clearly showing the correct time and date as provided by the camera in the bottom left corner:

enter image description here

However here is the output of ls -ltr:

brett@brett-HP-Laptop-17-bs0xx:~/Vidéos$ ls -ltr
total 9604
-rw-r--r-- 1 brett brett 9832867 avr 27 05:04 REC_0039.MOV
brett@brett-HP-Laptop-17-bs0xx:~/Vidéos$ 

The modified time showed by Linux is several hours behind the actual time this video was filmed. Why is this the case and how can I display the correct time in my file manager?

brettv
  • 103
  • 1
  • 7

2 Answers2

1

Like all Unix-like systems, Linux stores file timestamps internally in UTC and when you get the directory listing, the timestamps are converted to whatever is the selected timezone of your session.

If either the camera or your Linux system has incorrect timezone settings, errors like this might happen. The camera clearly had correct local time, but may have converted it to UTC incorrectly, causing incorrect timestamps; or your laptop is using a different timezone than what you expect, causing errors to the UTC -> local time conversion.

Run date; date -u on your laptop. It will display two timestamps: local time and UTC time. If local time is correct but UTC is wrong, you have a wrong timezone and your laptop's system clock has incorrect UTC time.

If you are looking something like a memory card taken from the camera, you might want to use a mount option to specify the timezone the camera uses: on VFAT/FAT32/exFAT filesystems, Linux assumes that the filesystem timestamps are stored using local time by default.

The mount option tz=UTC will assume the camera uses raw UTC on its filesystem rather than any local time, or time_offset=<minutes> can be used to explicitly specify the time offset, if the camera uses something non-UTC that is different from what your laptop uses.

telcoM
  • 96,466
1

The file modified time on the camera files was in local time. However Linux was assuming the camera's time was in UTC and converting it into local time, hence the difference of four hours between the camera time stamp and the modified time as shown by Linux.

Before mounting the camera, run the following command:

timedatectl set-local-rtc 1

Now the mounted camera shows the correct time in the file manager.

To get the RTC back to using UTC run:

timedatectl set-local-rtc 0

brettv
  • 103
  • 1
  • 7