Page MenuHomePhabricator

Eina_File: add creation time for files
Open, Incoming QueuePublic


On linux, statx allows to get file creation time, on Windows, this exists since XP

this will add member at the end of a private and public member

vtorri created this task.Wed, Jan 13, 1:18 AM

<vtorri> raster linux has added statx() function 5 years old. It allows to get the creation time. Is it possible to add that feature to eina file ?
<raster> vtorri: needs a feature detect
<vtorri> raster it add a member at the end of a private struct (Eina_File in eina_file_common.h) and in a public struct (Eina_File_Stat)
<raster> i'm not so sur ecreation time is always that useful on linux/unixen
<vtorri> and of course feature detect
<raster> it will require filesystem support it too
<vtorri> it can :
<vtorri> when a photo was created
<raster> but the way many things do saving/overwriting means modified time == creation time
<vtorri> for example
<vtorri> it helps me on Windows to know when i have taken a photo, to organise them
<vtorri> and on Windows, this exists since XP
<vtorri> statx was added in glibc 2.38 according to man page
<raster> well that assumes it keeps its creation time from the original files eg from a camera
<raster> and doesnt lose it along the way
<vtorri> of course
<raster> eg you cp the file over - it'll get a new creat time
<vtorri> it depends on the file system
<raster> when things save files like cfg or text files in vi/emacs etc.
<raster> tey use atomic replace
<raster> so write brand new file with file.tmp
<vtorri> on windows, it's possible
<raster> then rename() that file on top of the original file when written in an atomic replace
<vtorri> since the feature exists in fat and ntfs
<vtorri> on linux, i don't know
<vtorri> raster i'll try to add that
<raster> anyway - if create time doesnt exist - what to do?
<raster> ie no statx
<vtorri> set it to 0 or modified
<raster> "or" :) need to decide which :)
<vtorri> this must be said in the doc
<vtorri> i would said 0, and the user know there is no creation time and deal with that
<vtorri> for a file explorer it can either write the modified time or another text
<raster> actually
<raster> that's kind of a problem
<raster> you are right NORMALLY
<raster> but there are many linux diustros that literally set modified tiems on files to 0
<raster> ie jan 1 1970
<raster> and this actually caused bugs in efl.. as it didnt expect anything to have a timestamp of 0 :)
<raster> (caching issues)
<vtorri> ((time_t) -1)
<raster> well that might work
<raster> as its in the future...
<raster> and 1 second before the end of time itself :)
<vtorri> of course, doc should mention it
<raster> yup
<raster> but its choices to be made
<vtorri> of course