Camera Manufacturers: Please Use Accurate Time Stamps for Image Files

Update: October 4, 2023

My Canon and Nikon cameras use either the exFAT file system or the (older) FAT file system for image storage on their SD, SDxx, CF, CFexpress or XQD cards. In theory, the exFAT file system supports accurate time stamps up to a precision of 10 milliseconds. The FAT32 file system, in contrast, just offers 2 second accuracy for the modification time, or 10 millisecond for the creation time.

Unfortunately Canon has decided to cripple the time stamp accuracy down to a 1 second resolution. (I can’t speak for Sony or other manufacturers as I haven’t used their cameras recently.) Nikon’s VFAT format makes it even more difficult to get precise time information. But why should this matter?

Why Accurate Time Stamps?

Today’s digital cameras are capable of shooting at ever increasing frame rates. For DSLRs 5-10 frames per second is the norm, mirrorless cameras reach 20, 30, or even 120 frames per second. In such cases sorting the images by the time they were taken won’t necessarily show you the correct order.

Displaying Photos in the Sequence They Were Taken

When the camera writes images to a memory card, it gives the image a name and a 3 or 4 digit sequence number. When sorting by file name, the image files will appear in the order they were taken. But when the counter reaches the maximum number, it restarts from 0 or 1. This can can cause problems when sorting files by names.

These are relatively minor issues, since the file names with their sequence number still allow you to determine the proper sequence. But what if you rename photos?

I typically rename photos on import and try to give them a more meaningful name:

Jaffa_NIKON D850_20220430_002.NEF

In the above example I used the location name. The photos on a memory card may have come from different locations. Or sometimes I change the naming scheme, i.e. to the name of a person instead of a location, or some other identifier.

When using different naming schemes in the same folder, sorting by name does not guarantee that the pictures will appear in the order I shot them. But most people will be able to live with that. For example, Adobe Lightroom (LR) normally displays photos in the order they were taken.

But what if you use two or more cameras and want to know the correct sequence of your photos?

Timestamps and Heuristics

The real problems appear when using the time stamp to help identify a file. Recently I wrote a script that creates checksums (hashes) of all my files. Another script uses these hashes to check if files have become corrupted (which tends to happen from time to time).

I wanted to avoid recalculating hashes when files have been renamed or moved, so long as the content of the files hasn’t changed. Unfortunately there seems to be no easy way to accomplish the task. In the end I decided to use file modification time and file size as the two criteria that – when used together – can uniquely identify a file. (There is a little more to it, but let’s keep it simple.)

Below is an example of the file modification time, the size (in bytes), and the path name:

2022-05-06+09:55:59.0000000000	41879126	./Lightroom/heiko/2022/2022-05-06/Tel Aviv_Canon EOS R5_20220506_199.CR3
2022-05-06+09:56:04.0000000000	42432086	./Lightroom/heiko/2022/2022-05-06/Tel Aviv_Canon EOS R5_20220506_200.CR3
2022-05-06+09:56:05.0000000000	43032150	./Lightroom/heiko/2022/2022-05-06/Tel Aviv_Canon EOS R5_20220506_201.CR3
2022-05-06+09:56:20.0000000000	44434518	./Lightroom/heiko/2022/2022-05-06/Tel Aviv_Canon EOS R5_20220506_202.CR3

The above Canon EOS R5 image files, originally stored on an exFAT file system, do not offer accurate time stamps. Likewise the Nikon D850 NEF files below:

[heiko@102ND850]$ ls --full-time | cut -d' ' -f7-
2022-04-30 11:11:24.000000000 +0300 Jaffa_NIKON D850_20220430_153.NEF
2022-04-30 11:11:24.000000000 +0300 Jaffa_NIKON D850_20220430_154.NEF
2022-04-30 11:11:28.000000000 +0300 Jaffa_NIKON D850_20220430_155.NEF

My use of the file modification time for identifying renamed or moved files is by no means an isolated case. Backup programs use similar heuristics to identify file name or location changes. Another common use case for time stamps is in digital forensics.

How to Ensure Accurate Time Stamps

GPS and/or SIM

Unlike the most primitive cell phone, cameras normally do not keep an accurate track of the time. You need to manually enter the date and time as well as the time zone. Since the camera clock is usually not synced with a time server, the clock will drift – several seconds a month, sometimes minutes.

The are two ways to ensure accurate time: via the Internet or cell phone network if the camera has Wifi or a SIM card and access to a mobile network. Or the more traditional way by using a GPS module.

Some manufacturers offer a GPS module as an add-on. There are also third party GPS units but you will have to ensure that they are capable of syncing the time with the camera AND that they indeed are able to provide accurate time stamps. This also depends on the file system used, as mentioned before.

Integrating a GPS receiver would greatly simplify time keeping and accuracy, so would the addition of a SIM card. Another benefit of adding these features to a camera is theft protection, as advocated for example on Tony & Chelsey Northrup’s YouTube channel.

Adding a SIM and thus turning the camera into a “cellphone” allows you to share photos quickly and easily. Whether you are a professional shooting sports, a photojournalist, or you just want to share your latest photos on social media, this is the fastest and simplest way.

File System

The first thing you need to do is to check which file system your camera is using. Here is an example of a XQD card formatted in the Nikon D850 camera:

[heiko@102ND850]$ sudo file -sL /dev/sdf1
/dev/sdf1: DOS/MBR boot sector, code offset 0x3e+2, OEM-ID "NIKON5.0", Bytes/sector 2048, sectors/cluster 16, Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 2016, sectors 53147680 (volumes > 32 MB), FAT (32 bit), sectors/FAT 7168, reserved 0x1, serial number 0, label: "NIKON D850 "

In the above example, I plugged the card reader with the XQD card into my Linux host. /dev/sdf1 is the partition on the XQD card holding the photos. As you can see, the Nikon D850 formats the memory card using the FAT32 file system. That is bad! As I explained earlier, the FAT32 file system offers a modify time stamp accuracy down to 2 seconds.

Let’s examine an image file:

[heiko@102ND850]$ stat _D856581.NEF 
  File: _D856581.NEF
  Size: 51488079  	Blocks: 100608     IO Block: 32768  regular file
Device: 8,81	Inode: 1914        Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 1000/   heiko)   Gid: ( 1000/   heiko)
Access: 2022-05-13 03:00:00.000000000 +0300
Modify: 2022-05-01 22:26:20.000000000 +0300
Change: 2022-05-01 22:26:20.500000000 +0300
 Birth: -

But wait – what is the .5 fraction in the “Change” time stamp field? This field tells you the time when the metadata has changed, not the file content. According to a paper on file system forensics, there is even a difference between copying files and using copy/paste:

According to Lee (2015), if we copy a file from a FAT system to a NTFS system it will keep the same modified date but will change the create date and time to the current time. Where Lee (2015) notes if the file is cut and pasted it will keep the same modified date and time and will keep the creation date the same as before.

Filesystem Timestamps: What Makes Them Tick?” by Tony Knutson

My Canon EOS R5 uses the exFAT file system, which on paper supports 10 ms modification time accuracy, but didn’t implement it properly:

[heiko@100CANON]$ stat _97A0810.CR3 
  File: _97A0810.CR3
  Size: 51386454  	Blocks: 100608     IO Block: 131072 regular file
Device: 8,81	Inode: 1983        Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/   heiko)   Gid: ( 1000/   heiko)
Access: 2022-05-08 16:00:40.000000000 +0300
Modify: 2022-05-08 16:00:41.000000000 +0300
Change: 2022-05-08 16:00:41.000000000 +0300
 Birth: 2022-05-08 16:00:41.000000000 +0300

No luck with the Canon EOS R5 either, at least not with the current firmware 1.5.2.

While exFAT is definitely the better choice when it comes to file systems for memory cards, it’s far from optimal. Microsoft opened the exFAT specs in 2019 for use in the open source community. Before that it was proprietary, which explains why Nikon chose FAT32 for the D850 (and other older cameras).

Generally an open source file system would almost always be the better choice, providing camera vendors with access to source code and often better documentation.

Improvements

Update: The good news are that Nikon Z series cameras – at least the Nikon Z7-II and the Nikon Z8 – do utilize the maximum time stamp accuracy possible with the exFAT file system: 10 milliseconds.

[heiko@home]$ ls --full-time | cut -d' ' -f6-
2022-08-05 18:00:00.090000000 +0300 Sarona_NIKON Z 7_2_20220805_006.NEF
2022-08-05 18:00:36.040000000 +0300 Sarona_NIKON Z 7_2_20220805_007.NEF
2022-08-05 18:01:18.810000000 +0300 Sarona_NIKON Z 7_2_20220805_008.NEF
2022-08-05 18:01:22.170000000 +0300 Sarona_NIKON Z 7_2_20220805_009.NEF
2022-08-05 18:01:44.240000000 +0300 Sarona_NIKON Z 7_2_20220805_010.NEF

Above shows the modification times produced by a Nikon Z7-II as seen when the partition is mounted on a Linux system (note that the photos had been transferred to an NTFS disk). Below is an example for the Nikon Z8.

[heiko@home]$ ls --full-time | cut -d' ' -f6-
2023-09-03 16:49:27.490000000 +0300 Jerusalem_NIKON Z 8_20230903_312.NEF
2023-09-03 16:49:28.930000000 +0300 Jerusalem_NIKON Z 8_20230903_313.NEF
2023-09-03 16:49:30.150000000 +0300 Jerusalem_NIKON Z 8_20230903_314.NEF
2023-09-03 16:49:30.350000000 +0300 Jerusalem_NIKON Z 8_20230903_315.NEF
2023-09-03 16:54:04.950000000 +0300 Jerusalem_NIKON Z 8_20230903_316.NEF
2023-09-03 16:54:14.890000000 +0300 Jerusalem_NIKON Z 8_20230903_317.NEF

The two boldfaced time stamps show that the photos were shot just 200 milliseconds apart.

Summary

Cameras writing accurate time stamps along with their image files simplify image sorting and processing. When backing up or archiving photos, accurate time stamps allow applications to use heuristic methods to identify moved or renamed files.

In addition to these benefits, accurate timestamps open new possibilities. For instance you could use a series of photos to determine the speed of a moving subject (e.g. cyclist, etc.). Imagine a sports photographer using a simple application to determine the speed of an athlete by evaluating two consecutive photos.

Author: Heiko Sieger

The day has 24 hours. If that isn't enough, I also use the night.

2 thoughts on “Camera Manufacturers: Please Use Accurate Time Stamps for Image Files”

  1. Your question as to why I would need more exact time stamps is because I shoot lightning and would like to know how many milliseconds between frames.

  2. Thanks for sharing your reason. One thing you should note is that not all cameras are equal. For example, while the Nikon D850 uses the inferior FAT32 and the Canon R5 the better exFAT format, yet doesn’t provide accurate time stamps, there is a glimmer of hope on the horizon: The new Nikon Z cameras (at least the Nikon Z7-II and the Z8) provide time stamps with an accuracy of 1/100 second, i.e. 10 milliseconds. Unless one shoots the Nikon Z8 in 120 pictures/second jpg mode, the time stamps will be accurate enough for each photo to carry a unique time stamp. I will update my post accordingly.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.