Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys.FileStat.ctime updated with more accurate file creation time #1063

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joshtynjala
Copy link
Contributor

Linux: Uses statx syscall for this field only to get stx_btime.tv_sec
macOS: Still uses the existing stat syscall, but accesses the macOS-only st_birthtime field instead

Historically, the POSIX standard did not require file systems to store the file creation time at all, so the stat syscall did not provide it. Modern file systems now store this value, and different operating systems provide it in different ways. The previous value of ctime from the stat syscall is actually the "status change time". This value may initially match the file creation time, but it can be updated after the file is modified in certain ways (including the file size changing, which is very common). The new value is more accurate, better matching how Haxe documents this field.

Linux: Uses statx syscall on Linux to get stx_btime.tv_sec for this field only
macOS: Still uses the existing stat syscall, but accesses the macOS-only st_birthtime field instead

Historically, the POSIX standard did not require file systems to store the file creation time at all, so the stat syscall did not provide it. Modern file systems now store this value, and different operating systems provide it in different ways. The previous value of ctime from the stat syscall is actually the "status change time". This value may initially match the file creation time, but it can be updated after the file is modified in certain ways (including the file size changing, which is very common). The new value is more accurate, better matching how Haxe documents this field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant