2012-04-15 18:33:42 +00:00
|
|
|
package schema
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"syscall"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
populateSchemaStat = append(populateSchemaStat, populateSchemaCtime)
|
|
|
|
}
|
|
|
|
|
2013-01-22 04:56:12 +00:00
|
|
|
func populateSchemaCtime(m map[string]interface{}, fi os.FileInfo) {
|
2012-04-15 18:33:42 +00:00
|
|
|
st, ok := fi.Sys().(*syscall.Stat_t)
|
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Include the ctime too, if it differs.
|
|
|
|
sec, nsec := st.Ctim.Unix()
|
|
|
|
ctime := time.Unix(sec, nsec)
|
|
|
|
if sec != 0 && !ctime.Equal(fi.ModTime()) {
|
|
|
|
m["unixCtime"] = RFC3339FromTime(ctime)
|
|
|
|
}
|
|
|
|
}
|