ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: EM1336 on May 14, 2018, 02:18:28 PM

Title: Interesting results changing file system dates 1969 to 1968, and 1980 to 1979
Post by: EM1336 on May 14, 2018, 02:18:28 PM
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:


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:


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!
Title: Re: Interesting results changing file system dates 1969 to 1968, and 1980 to 1979
Post by: StarGeek on May 14, 2018, 04:36:46 PM
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 (https://exiftool.org/forum/index.php/topic,8848.msg45531.html)
Windows FileAccessDate, FileCreateDate, and FileModifyDate wrong century (https://exiftool.org/forum/index.php/topic,8704.msg44659.html#msg44659)

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 (https://superuser.com/questions/292630/how-can-i-change-the-timestamp-on-a-file) 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.
Title: Re: Interesting results changing file system dates 1969 to 1968, and 1980 to 1979
Post by: Phil Harvey on May 14, 2018, 06:23:56 PM
System date/time routines are historically only reliable from 1970 to 2034.  Your mileage may vary.

- Phil
Title: Re: Interesting results changing file system dates 1969 to 1968, and 1980 to 1979
Post by: StarGeek on May 19, 2018, 12:04:59 PM
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 (https://superuser.com/questions/796762/what-is-the-range-of-dates-that-windows-explorer-can-display) that helps explain it.