linux获取纳秒函数,linux – 获取一个纳秒精确的atime,mtime,ctime字段的文件(stat?)...

第二分辨率时间是在以下领域:

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 */

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.

所以,nsec部分的时间是相同的“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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值