"Touching" Create Date?

Unlike some other OSs, Haiku has a “Creation Time/Date” (but no “Last Access Time”) in addition to the “Last Modified Time”. Is there any way to adjust the Creation Time after the file has been created? The ‘touch’ app, as Posix, only knows about the Modified and (useless) Access times.

This might seem like a sneaky thing to want to do, but here’s my situation… I get photos from my digicam that have an appropriate creation date. When I get them into Haiku, I want to add “Title” and “Description” fields to the internal EXIF data they contain, and I have a script (using Exiftool and Gadgeteer) that does this nicely. However, Exiftool creates a new file to do this (leaving a renamed original). The script touches the new file to match its Modified date to the original, but it can’t fo anything about the new Creation date. The “logically useful” scheme would be for the new file to phony up the creation date to when the orginal was taken, and set the modified one to when the details were added, but I can’t see any way to do that. (The EXIF data still has the original date, but it has to be extracted to see it.)

[EDIT: I guess I was working from ancient info! FAT32 does have a Creation Time field, so Haiku just copies that. I imagine that no OS actually lets you change it, but I wish Haiku would!]

Actually, it’s incredibly easy to change this in Windows. It’s something like:
File.SetCreationDate(FilePath, DesiredDateTime);

So far I’m not seeing anything similar in the Haiku Book.

Microsoft file systems (FAT and NTFS) are the only ones using a file creation (or birth) time stamps.

See ( http://www.forensicswiki.org/wiki/MAC_times ) for details about how the various time stamps are handled during file operations in Windows.

In the Microsoft world, one could hand-up with a file with a 1980 last modified time stamp and a 2018 creation time stamp for a while which has been copied a few times since its original creation in 1980!

There are tools to manipulate the FAT and NTFS time stamps - from Windows. I don’t know about other operating systems.

Hah – yes. I was really hop[ing for a command like ‘touch’, but I don’t think such exists. However, as soon as i checked, I found that the API of course has a method for that. BEntry is derived from BStatable, which has the appropriate ‘SetCreationTime(time_t)’ method.

Guess I just have to write my own little app :slight_smile:

If/when you write your own little app for this, be aware that FAT time stamps are based on local time and have a 2 seconds resolution while NTFS time stamps are based on UTC time and have a 100 millisecond resolution.

The app does not need to care about this. It is an implementation detail of each filesystem and the OS is there to provide the abstraction layer.

TimeZones of file timestamps is something that never caught my attention at all! And after playing with them for a while I’m still rather befuddled.

As far as I can tell, Haiku uses UTC. If I switch my timezone, file times change appropriately. And it seems to assume that FAT32 files were stamped with local time – they don’t adjust with a zone change.

Linux is rather amusing… If I mount a FAT32 drive, it shows the times as local. If I ‘touch’ a file though, the stamp is set to UTC!

QUICK EDIT: I misspoke slightly – must have looked too fast… Linux always thinks the FAT32 timestamp is UTC, so at least it’s consistent.

Things are further confused by a Haiku bug when writing a file to Fat32… it sends the file years into the future! Currently it ends up in the year 2026! (Yes – I have to report this bug. I will get around to it… EDIT: OR when Trac lets me do it! I’m still being bedevilled by Captchas – this time invisible ones!)

Haiku (R1A4.1) also gets confused when reading NTFS volumes - some folders/files show up with last modified time stamps in the first decade of the 20th century! A minor annoyance at times!