`stat` only provide timestamp down to second instead of nanosecond
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
Hi maintainer,
stat in php only provide presicion down to second, but it could be down to nanosecond.
File: abc.xyz
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 8,2 Inode: 6160531 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 0/root) Gid: ( 0/root)
Access: 2023-08-12 09:10:14.152726478 +0700
Modify: 2023-08-12 09:10:14.152726478 +0700
Change: 2023-08-12 09:10:14.152726478 +0700
Birth: 2023-08-12 09:10:14.152726478 +0700
[
...,
"atime" => 1691806214,
"mtime" => 1691806214,
"ctime" => 1691806214,
...
]
I'm aware that https://linux.die.net/man/2/stat does explain it Since kernel 2.5.48, the stat structure supports nanosecond resolution for the three file timestamp fields..
I was running into this problem today, run test need to ensure directory was created within 1s, which cannot be done if read from php stat.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names PHP's stat API and Linux's nanosecond-capable stat timestamps, but no source file or test. Start by locating the PHP implementation and existing tests for stat timestamp fields, then compare their values with the filesystem timestamps shown by Linux stat. Done means PHP exposes the available sub-second precision and the behavior is covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100