File Modified Time Fractional Seconds? (Manjaro-Plasma, EXT4 on SSD)

I noticed in the docs for Perl’s “Time::HiRes” module that it includes a nanosecond-resolution version of “lstat”, so I could include that in my Perl scripts; however, it would do nothing if that information is not actually present in the directories being read. So my question is, on an up-to-date Manjaro-Plasma system, using an EXT4 file system on an SSD, how does the OS store the “seconds” part of “file modified time”? Is it floating-point, integer-plus-fraction, integer-only, or what?

The ext4 file system does support nanosecond resolution on stored times if the inodes are big enough to support the extended time information (256 bytes or larger).

You can check the inode size of your system with the following command:

sudo tune2fs -l /dev/yourpartitionname | grep "Inode size"

… just on very first impression upon reading:

a nanosecond is a very tiny amount of time
I’d think that a “normal” system timer could not provide that resolution.

If that is so - the information would not be present (down to that resolution).

That would not be Plasma specific - but due to what the underlying OS (or the hardware) is capable of doing.

@fasto seems to have actual information - instead of my conjecture and doubt :sunglasses:

Ok, let me see if that information is present in an “ls --full-time” printout of a collection of scenic photos:

2020-08-26 06:33:06.000000000 -0700
2020-11-26 19:48:23.000000000 -0800
2021-12-08 17:17:59.000000000 -0800
2022-10-27 12:57:39.409183409 -0700
2022-10-27 12:57:39.425850077 -0700
2022-10-27 12:57:39.445850077 -0700
2020-06-13 19:18:44.000000000 -0700
2022-10-27 12:57:39.469183412 -0700
2022-10-27 12:57:39.512516747 -0700

Interesting! It seems that yes, this system is storing file-mod times to the nearest nanosecond, but roughly half of these files do not have that information. I suspect it’s because these files are from all different sources, and some of those sources did not include fractional seconds on mod times.

%echo “Hello!” > Fred.txt
%ls --full-time Fred.txt
-rw-rw-r-- 1 aragorn aragorn 6 2023-03-09 13:06:10.584676566 -0800 Fred.txt

So, it appears that yes, Manjaro stores that info; but no, not all files are going to have that info, depending on their provenance.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.