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

On Windows 10 - ctime is the same as the mtime #31022

Open
lawless-m opened this issue Feb 9, 2019 · 6 comments
Open

On Windows 10 - ctime is the same as the mtime #31022

lawless-m opened this issue Feb 9, 2019 · 6 comments
Labels
system:windows Affects only Windows

Comments

@lawless-m
Copy link

lawless-m commented Feb 9, 2019

stat.jl

mtime | Unix timestamp of when the file was last modified

ctime | Unix timestamp of when the file was created

c:\temp\test.txt

Properties tab
Created: ‎09 ‎February ‎2019, ‏‎13:16:44
Modified: 09 ‎February ‎2019, ‏‎13:16:55
Accessed: 09 ‎February ‎2019, ‏‎13:16:44

julia> Dates.unix2datetime(ctime("c:\\temp\\test.txt"))
2019-02-09T13:16:55.233

julia> Dates.unix2datetime(mtime("c:\\temp\\test.txt"))
2019-02-09T13:16:55.233

wait a few minutes, edit the file

julia> Dates.unix2datetime(mtime("c:\\temp\\test.txt"))
2019-02-09T13:25:16.394

julia> Dates.unix2datetime(ctime("c:\\temp\\test.txt"))
2019-02-09T13:25:16.394

@nalimilan nalimilan added the system:windows Affects only Windows label Feb 10, 2019
@clouds56
Copy link
Contributor

@bicycle1885 I know the ctime means "change time".
Is there anyway to access btime (birth time)?

@elextr
Copy link

elextr commented Jul 23, 2021

Isn't ctime on windows creation time and on Linux change time?

@clouds56
Copy link
Contributor

@elextr no, on windows it's just the same as mtime

@elextr
Copy link

elextr commented Jul 23, 2021

@clouds56 what I meant was that it means different things on the underlying operating system and the Windows meaning seems to be the behaviour the OP is expecting.

But libuv deliberately makes ctime always have the linux meaning change time on all platforms. So it likely changes when a file is edited and therefore equals mtime, so the case described by the OP is expected.

But changing just the metadata (eg permissions/ACLs) should change only ctime not mtime so its not always the same.

As noted in #39731 ctime description was wrong and has been fixed, and birth time is not available on all platforms.

@elextr
Copy link

elextr commented Jul 23, 2021

This probably should have been closed by #39731

@lawless-m
Copy link
Author

the behaviour I was expecting was ctime was fixed at creation and mtime changed when modified

I can't remember why now, but it was something like checking if mtime > ctime to do something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system:windows Affects only Windows
Projects
None yet
Development

No branches or pull requests

4 participants