github.com/olivere/camlistore@v0.0.0-20140121221811-1b7ac2da0199/pkg/schema/schema_linux.go (about)

     1  //+build linux
     2  //+build !appengine
     3  
     4  package schema
     5  
     6  import (
     7  	"os"
     8  	"syscall"
     9  	"time"
    10  )
    11  
    12  func init() {
    13  	populateSchemaStat = append(populateSchemaStat, populateSchemaCtime)
    14  }
    15  
    16  func populateSchemaCtime(m map[string]interface{}, fi os.FileInfo) {
    17  	st, ok := fi.Sys().(*syscall.Stat_t)
    18  	if !ok {
    19  		return
    20  	}
    21  
    22  	// Include the ctime too, if it differs.
    23  	sec, nsec := st.Ctim.Unix()
    24  	ctime := time.Unix(sec, nsec)
    25  	if sec != 0 && !ctime.Equal(fi.ModTime()) {
    26  		m["unixCtime"] = RFC3339FromTime(ctime)
    27  	}
    28  }