-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add file create and modify time in selection query
- Loading branch information
1 parent
8152ebe
commit 4c1b4fd
Showing
6 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package util | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
"time" | ||
) | ||
|
||
func GetFileCreatedAt(path string) string { | ||
stat, err := os.Stat(path) | ||
if err != nil { | ||
return "-" | ||
} | ||
|
||
statSys := stat.Sys().(*syscall.Stat_t) | ||
creationTime := time.Unix(statSys.Birthtimespec.Sec, int64(statSys.Birthtimespec.Nsec)) | ||
|
||
return FormatTime(creationTime) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package util | ||
|
||
func GetFileCreatedAt(path string) string { | ||
return "-" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package util | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
"time" | ||
) | ||
|
||
func GetFileCreatedAt(path string) string { | ||
stat, err := os.Stat(path) | ||
if err != nil { | ||
return "-" | ||
} | ||
|
||
statSys := stat.Sys().(*syscall.Win32FileAttributeData) | ||
creationTime := time.Unix(0, statSys.CreationTime.Nanoseconds()) | ||
|
||
return FormatTime(creationTime) | ||
} |