I have a file with this from the info (mac os):
Created: Tuesday, 26 May 2020 at 11:21
Modified: 26 May 2021 at 15:40
And after some research I tried to do:
ctim := fi.Sys().(*syscall.Stat_t).Ctim
atim := fi.Sys().(*syscall.Stat_t).Atim
mtim := fi.Sys().(*syscall.Stat_t).Mtim
log.Println("ctim:", time.Unix(ctim.Sec, ctim.Nsec))
log.Println("atim:", time.Unix(atim.Sec, atim.Nsec))
log.Println("mtim:", time.Unix(mtim.Sec, mtim.Nsec))
but they all return:
app_1 | 2021/05/26 15:40:17 ctim: 2021-05-26 15:40:17.199113879 +0000 UTC
app_1 | 2021/05/26 15:40:17 atim: 2021-05-26 15:40:16.457499729 +0000 UTC
app_1 | 2021/05/26 15:40:17 mtim: 2021-05-26 15:40:05.982391804 +0000 UTC
Also I'm using docker + docker-compose, building from golang:1.14-stretch
and saving binary within debian:bullseye-slim
.
Clearly this is not the creation time of the file. Any idea how I can get this information?