LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > maybeJosiah
User Name
Password

Notices


Rate this Entry

About Linux timestamps maybe

Posted 01-17-2024 at 02:57 PM by maybeJosiah
Updated 01-31-2024 at 03:42 PM by maybeJosiah (format times maybe)

All Linux has changed time AKA ctime, access time AKA atime, and modified time AKA mtime. Some Linux also has created time/birth time AKA crtime. Like universally all these may be accessed via "stat" with Bash. You may read "stat --help" in your terminal for more specific information. Changed time is last time metadata changed, and others are self explanatory. On some distros "crtime" may be replaced by "btime" and/or "ctime" may be replaved by "chgtime". There may also be with a "st_" prefix so check "sif -l" in debugfs if using debugfs.

To set timestamps on Linux, commonly there is "touch" but that is only for mtime and atime. On ext2 to ext4 there is debugfs. Only use that on unmounted file systems. Two things to set in that, time field as with time names above abbreviated like mtime and that with _extra at end of it. Regular part is date as either hexadecimal seconds since epoch with "@0x" before it or YYYYMMDDHHmmSS +%Y%m%d%H%M%S year month day hour minute second, with that being in UTC time zone, to second precision and that _extra is nanoseconds times 4 of your timestamps. rsync also has all timestamps setting upon copy supported on many distros. Read "rsync --help" or "man rsync" from in a terminal for more info. I find with debugfs, order to set in is crtime, atime, mtime, ctime. In debugfs there may also be like those times and extras with prefix "i_". I recommend setting all you can when you should and with "i_" should be like without.

Another interesting thing I know is that some systems store different numbers of bits for timestamps. If you have 32 bit timestamps please upgrade before 2038. Otherwise you may have 34 bit on ext4 or 64 bit timestamps. A good way to check for size of timestamps is if your nanos has 9 digits means 64 bit, 6 digits, 32 bit. Obviously 32 bit machines are more likely to have 32 bit timestamps and 64 bit machines are likely to have 64 bit timestamps and which of 32 bit or 64 bit distro is also a major factor like machine.

Thank you Petri Kaukasoina, on forum, and Theodore Ts'o, maker of debugfs, for info about debugfs. X E.
Posted in Uncategorized
Views 166 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 08:07 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration