![]() ![]() With a CPAN module, you have to teach your users how to install Perl modules. With the current Perl, my users only have to run the script. Another option would be to return something more than just an integer (say an array ref) for atime/ctime/mtime but that might be more trouble than it's worth too.Ī CPAN module has an important drawback: it is not available everywhere. Putting the nanoseconds on the end of the list would likely make them the least likely to cause issues but wouldn't make much immediate sense as to the ordering of the elements. Maybe something like lstat_ns(), stat_ns() or nanostat(), nanolstat()? They'd have to have an extra value returned in the list so they wouldn't be fully compatible with stat() and lstat() no matter what. I don't think it could be done without a different function to get that representation. That's also ignoring what will happen with 32bit perls that don't have 64bit integer support. Those combined mean that you won't be able to represent the time very well in a single 64bit integer. The nano-seconds themselves already takes 32bits minimum to represent, and we're quickly reaching the limits of a 32bit epoch. Yea I think if this were to be done it'd have to be done by returning multiple values for the same reason that the Linux kernel does it. Otherwise, if you got 123456, do you assume that you only have microsecond precision, and not nanosecond? Would it not be easier for everybody to just return the nanosecond value as an integer? Like Linux does: It would hopefully be zero-padded on the left. Depending on the overall value and the underlying platform, a floating-point value may not actually reach nanosecond precision.Īnd a string is also inconvenient and slow to handle. Think about adding time offsets: with every floating-point operation you lose precision. A floating-point number is always problematic to compare, and unnecessarily slow anyway. If a filesystem does not support nanoseconds, it's no problem: Linux just returns a value of 0 nanoseconds if the filesystem is FAT32.Ī "dualvar of a double and string", whatever that is, does not sound appealing. So we only have 2 points left: (b) nanosecond resolution, and You are right, I am sorry I got this mixed up. Or the one provided by Time::HiRes, is an epoch timestamp. The value of mtime, from either the core stat function ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |