Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6473141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:25:50+00:00 2026-05-25T06:25:50+00:00

Some filesystems (e.g. ext4 and JFS) offer nanosecond resolution of atime/mtime fields. How can

  • 0

Some filesystems (e.g. ext4 and JFS) offer nanosecond resolution of atime/mtime fields. How can I read ns-resolution fields? The stat syscall returns time_t which is a second-resolution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:25:50+00:00Added an answer on May 25, 2026 at 6:25 am

    The second-resolution times are in the fields:

               time_t    st_atime;   /* time of last access */
               time_t    st_mtime;   /* time of last modification */
               time_t    st_ctime;   /* time of last status change */
    

    But “NOTES” section of the man http://www.kernel.org/doc/man-pages/online/pages/man2/stat.2.html says:

    Since kernel 2.5.48, the stat structure supports nanosecond resolution for the three file timestamp fields. Glibc exposes the nanosecond component of each
    field using names of the form st_atim.tv_nsec if the _BSD_SOURCE or
    _SVID_SOURCE feature test macro is defined. These fields are specified in
    POSIX.1-2008, and, starting with version 2.12, glibc also exposes these field
    names if _POSIX_C_SOURCE is defined with the value 200809L or greater, or
    _XOPEN_SOURCE is defined with the value 700 or greater. If none of the
    aforementioned macros are defined, then the nanosecond values are exposed with
    names of the form st_atimensec.

    So, nsec parts of times are in the same “struct stat”: ( /usr/include/asm/stat.h )

     unsigned long st_atime_nsec;
    
     unsigned int st_mtime_nsec;
    
     unsigned long st_ctime_nsec;
    
     #define STAT_HAVE_NSEC 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone suggest some good materials for learning more about the Linux filesystem and
Some time ago I've read an article on CLR, where author showed that if
I have some old images of old Linux filesystems in flat file format. they
It is obvious that in general the read(2) system call can return less bytes
I've just got to know that some filesystems, such as FAT, store filenames as
I need some opinions pointers on creating pseudo-filesystems for linux/*nix systems. Firstly when I
I'm trying to do some research around file systems and I've probably confused myself.
Some background info: I am currently writing a bootloader in protected mode while learning
Some clients experience an app crash directly when they launch it. Here's the code
Some background info: I'm trying to run a server program in python 2.5.1 (the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.