Interesting results changing file system dates 1969 to 1968, and 1980 to 1979

Started by EM1336, May 14, 2018, 02:18:28 PM

Previous topic - Next topic

EM1336

Interesting results when using ExifTool to change file system dates ("pseudo" tags) from 1969 to 1968, or from 1980 to 1979

System type:  Windows 7 Professional x64 and NTFS exclusively, running on a 2011 MacBook Pro.  Windows running natively on its own NTFS SSD (not FAT32).  Not using Parallels Desktop.
ExifTool version 10.65.
Specific command lines:

Exiftool -filecreatedate="1969:01:01 01:01:01" -filemodifydate="1969:01:01 01:01:01" filename.jpg
Exiftool -filecreatedate="1968:12:31 23:59:59" -filemodifydate="1968:12:31 23:59:59" filename.jpg


Exiftool -filecreatedate="1980:01:01 01:01:01" -filemodifydate="1980:01:01 01:01:01" filename.jpg
Exiftool -filecreatedate="1979:12:31 01:01:01" -filemodifydate="1979:12:31 01:01:01" filename.jpg


I was using ExifToolGUI to change both the file system timestamps and Exif timestamps of scanned family photos to match the times when the events in the photos occurred.  (I like all of the timestamps to be as consistent as possible.)  For example, I scanned a photo from mid-afternoon on Christmas Eve, 1965 so I changed the file system "pseudo" tags FileCreateDate, FileModifyDate, DateTimeOriginal, and the Exif tags DateCreate and DateModify to "1965:12:24 15:30:30".  Upon doing so, I noticed a strange result:  ExifToolGUI changed the Exif dates to 24 Dec 1965, but changed the file system dates to 24 Dec 2065!

I then closed ExifToolGUI and tried using ExifTool, with the same results.  Note that the Exif timestamps (using the -alldates option) work fine and stay in the 1900s.  Only the file system timestamps inexplicably plunge forward one century.  Experimenting further, I discovered two transitition points:



    • When you change the file system timestamp from 1 Jan 1969 to 31 Dec 1968 or earlier, ExifTool starts using 20 as the first two digits, rather than 19.

    • When you change the file system timestamp from 1 Jan 1980 to 31 Dec 1979 at 1:01 or earlier, Windows 7 stops displaying the Date Created in Windows Explorer Details view.  When I used 31 Dec 1979 23:59:59, Windows Explorer on my computer still displayed the file as 1 Jan 1980 in Details view (despite the file appearing as 1979:12:31 23:59:59 in ExifTool and ExifToolGUI).  When I kept the 31 Dec 1979 date but changed the time to 01:01:01, the Date Created disappeared from Details view.

I suspect that the second problem has nothing to do with ExifTool and it is probably a limitation of Windows 7.

I tried using a little shell-extension utility known as Febooti FileTweak and was able to change the file system timestamps to dates prior to 1 Jan 1969 without them rocketing forward into the 21st century.  However, FileTweak had no effect on the 1979 disappearing timestamp issue.  Searching on the ExifTool forums and Google, I found a few tidbits that may or may not apply to what I'm seeing:


  • ExifTool probably has a limit of 1970 due to the date/time functions that it uses.
  • When using the touch command on a Mac to set the timestamp on a FAT32 thumb drive, the date and time will sometimes reset to 1 Jan 1970.
  • You generally can't set a timestamp on FAT and FAT32 partitions to a date before 1 Jan 1980, whereas you should be good to set timestamps as far back as 1752 when using NTFS.
  • NTFS records time as 100-nanosecond intervals since 1 Jan 1601, chosen because of the Gregorian calendar's 400-year cycle and the particular 400-year cycle that was active when Microsoft was designing Windows NT.

Has anyone found a way around the 1968 glitch, other than using FileTweak?  Maybe I shouldn't change the file system timestamps at all, and should only change the Exif DateTimeOriginal tag.  Why exactly does ExifTool stumble with file system timestamps prior to 1969?  I don't have Windows 10 and have no immediate plans to upgrade as I'm perfectly happy with Win7 and High Sierra.  Can someone with Win10 please check these 2 transition points and see if there's any difference when using Win10?

Thanks!

StarGeek

Quote from: EM1336 on May 14, 2018, 02:18:28 PM
When you change the file system timestamp from 1 Jan 1969 to 31 Dec 1968 or earlier, ExifTool starts using 20 as the first two digits, rather than 19.

Previous threads on the subject:
Use of FileModifyDate not working in my batch job
Windows FileAccessDate, FileCreateDate, and FileModifyDate wrong century

tl;dr,
ExifTool uses standard Perl date/time routines to do the necessary conversions.  These routines are based on an epoch date of 1970, and the behaviour before that can be funny.

What I find interesting is that my previous experiments showed that exiftool couldn't set dates between 1900:01:01 00:00:00 and 1967:12:31 23:59:59.  That fact that you have problems at 1968 instead makes me wonder if I messed up.  I'll have to recheck.

QuoteWhen you change the file system timestamp from 1 Jan 1980 to 31 Dec 1979 at 1:01 or earlier, Windows 7 stops displaying the Date Created in Windows Explorer Details view.  When I used 31 Dec 1979 23:59:59, Windows Explorer on my computer still displayed the file as 1 Jan 1980 in Details view (despite the file appearing as 1979:12:31 23:59:59 in ExifTool and ExifToolGUI).  When I kept the 31 Dec 1979 date but changed the time to 01:01:01, the Date Created disappeared from Details view.

Interesting...  I'll check it out.

QuoteHas anyone found a way around the 1968 glitch, other than using FileTweak?

This SuperUser answer has some options.

QuoteMaybe I shouldn't change the file system timestamps at all, and should only change the Exif DateTimeOriginal tag.

The system timestamps are too fragile to depend upon, IMO.  The FileModifyDate will change any time the file is opened for write access, even if nothing is changed.  There are legitimate reasons to change them but setting them to early dates, IMO, isn't one of them.  That's what the internal Metadata is for.

QuoteCan someone with Win10 please check these 2 transition points and see if there's any difference when using Win10?

My testing that I mentioned above was done on Win 10.  I'll retest and check the other point out soon.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

System date/time routines are historically only reliable from 1970 to 2034.  Your mileage may vary.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

I finally got around to checking on this.  The date range that exiftool cannot set is as you said, 1900:01:01 00:00:00 and 1968:12:31 23:59:59.  My previous research on this was probably in error.

And the Windows 10 won't show FileCreateDate or FileModifyDate before 1980 under Properties.  I did finally find this SuperUser answer that helps explain it.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).