I have a file (a gzipped tar) on my Ubuntu 16.04.1 system. If I get its properties from the context menu, it is shown that
Accessed: Wed, Aug 17 2016 01:39:46 Modified: Wed, Aug 17 2016 01:39:44
which makes perfect sense to me. Now I copied this file to an USB stick, plugged it into a different computer, where the properties of the copied file are now as follows:
Accessed: Wed, Aug 17 2016 00:00:00 Modified: Wed, Aug 16 2016 22:39:44
Note that the modification date time stamp of the copied file is -3h, and the accessed timestamp is maybe unknown?
Does this make sense? If so, then what is going on here? Note: date/time settings are fine, now it is definitely not midnight.
2 Answers
In Linux there are 3 defines:
struct timespec st_atim; /* time of last access */ struct timespec st_mtim; /* time of last modification */ struct timespec st_ctim; /* time of last status change */
reference "man 2 fstat": The field st_atime is changed by file accesses, for example, by execve(2), mknod(2), pipe(2), utime(2), and read(2) (of more than zero bytes). Other routines, like mmap(2), may or may not update st_atime. The field st_mtime is changed by file modifications, for example, by mknod(2), truncate(2), utime(2), and write(2) (of more than zero bytes). Moreover, st_mtime of a directory is changed by the creation or deletion of files in that directory. The st_mtime field is not changed for changes in owner, group, hard link count, or mode. The field st_ctime is changed by writing or by setting inode information (i.e., owner, group, link count, mode, etc.). Note: the order of fields in the stat structure varies somewhat across architectures.
So if you use another architecture or a non UNIX File system this results you may occurs cause of this description for fstat information.
1Just for completness:
- Not all filesystem handles all times:
st_atime, st_mtime and st_ctime is stored in EXT2-3-4 for sure.
Here something was understood in other computer (at least the day).
This suspects the other computer had Windows based OS. - 3 hours (or other, round time) delta between file access time in Linux and Windows os.
This is done because Linux uses the UTC always, Windows ... not always, sometimes (in some filesystems, in some programs) uses the local time.
For clarification... Is your local time exactly 3 hours away from UTC?
However you can ask Windows to behave somewhat more consistent: