本文整理匯總了Golang中syscall.Timespec.Sec方法的典型用法代碼示例。如果您正苦於以下問題:Golang Timespec.Sec方法的具體用法?Golang Timespec.Sec怎麽用?Golang Timespec.Sec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類syscall.Timespec
的用法示例。
在下文中一共展示了Timespec.Sec方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ParseCMTime
func (conf *FindConf) ParseCMTime() {
now := time.Now().Unix()
var ct, mt, at syscall.Timespec
ct.Sec = now - int64(conf.Cmin*60) - int64(conf.Ctime*24*3600)
mt.Sec = now - int64(conf.Mmin*60) - int64(conf.Mtime*24*3600)
at.Sec = now - int64(conf.Amin*60) - int64(conf.Atime*24*3600)
conf.Stat.Ctim = ct
conf.Stat.Mtim = mt
conf.Stat.Atim = at
}
示例2: compareRegularInodes
func compareRegularInodes(left, right *RegularInode, logWriter io.Writer) bool {
if left.Mode != right.Mode {
if logWriter != nil {
fmt.Fprintf(logWriter, "Mode: left vs. right: %x vs. %x\n",
left.Mode, right.Mode)
}
return false
}
if left.Uid != right.Uid {
if logWriter != nil {
fmt.Fprintf(logWriter, "Uid: left vs. right: %d vs. %d\n",
left.Uid, right.Uid)
}
return false
}
if left.Gid != right.Gid {
if logWriter != nil {
fmt.Fprintf(logWriter, "Gid: left vs. right: %d vs. %d\n",
left.Gid, right.Gid)
}
return false
}
if left.Size != right.Size {
if logWriter != nil {
fmt.Fprintf(logWriter, "Size: left vs. right: %d vs. %d\n",
left.Size, right.Size)
}
return false
}
var leftMtime, rightMtime syscall.Timespec
leftMtime.Sec = left.MtimeSeconds
leftMtime.Nsec = int64(left.MtimeNanoSeconds)
rightMtime.Sec = right.MtimeSeconds
rightMtime.Nsec = int64(right.MtimeNanoSeconds)
if leftMtime != rightMtime {
if logWriter != nil {
fmt.Fprintf(logWriter, "Mtime: left vs. right: %v vs. %v\n",
leftMtime, rightMtime)
}
return false
}
if bytes.Compare(left.Hash[:], right.Hash[:]) != 0 {
if logWriter != nil {
fmt.Fprintf(logWriter, "hash: left vs. right: %x vs. %x\n",
left.Hash, right.Hash)
}
return false
}
return true
}
示例3: compareInodes
func compareInodes(left, right *Inode, logWriter io.Writer) bool {
if left.Mode != right.Mode {
if logWriter != nil {
fmt.Fprintf(logWriter, "Mode: left vs. right: %o vs. %o\n",
left.Mode, right.Mode)
}
return false
}
if left.Uid != right.Uid {
if logWriter != nil {
fmt.Fprintf(logWriter, "Uid: left vs. right: %d vs. %d\n",
left.Uid, right.Uid)
}
return false
}
if left.Gid != right.Gid {
if logWriter != nil {
fmt.Fprintf(logWriter, "Gid: left vs. right: %d vs. %d\n",
left.Gid, right.Gid)
}
return false
}
var leftMtime, rightMtime syscall.Timespec
leftMtime.Sec = left.MtimeSeconds
leftMtime.Nsec = int64(left.MtimeNanoSeconds)
rightMtime.Sec = right.MtimeSeconds
rightMtime.Nsec = int64(right.MtimeNanoSeconds)
if leftMtime != rightMtime {
if logWriter != nil {
fmt.Fprintf(logWriter, "Mtime: left vs. right: %v vs. %v\n",
leftMtime, rightMtime)
}
return false
}
if left.Mode&syscall.S_IFMT == syscall.S_IFBLK ||
left.Mode&syscall.S_IFMT == syscall.S_IFCHR {
if left.Rdev != right.Rdev {
if logWriter != nil {
fmt.Fprintf(logWriter, "Rdev: left vs. right: %#x vs. %#x\n",
left.Rdev, right.Rdev)
}
return false
}
}
return true
}
示例4: compareSpecialInodesMetadata
func compareSpecialInodesMetadata(left, right *SpecialInode,
logWriter io.Writer) bool {
if left == right {
return true
}
if left.Mode != right.Mode {
if logWriter != nil {
fmt.Fprintf(logWriter, "Mode: left vs. right: %o vs. %o\n",
left.Mode, right.Mode)
}
return false
}
if left.Uid != right.Uid {
if logWriter != nil {
fmt.Fprintf(logWriter, "Uid: left vs. right: %d vs. %d\n",
left.Uid, right.Uid)
}
return false
}
if left.Gid != right.Gid {
if logWriter != nil {
fmt.Fprintf(logWriter, "Gid: left vs. right: %d vs. %d\n",
left.Gid, right.Gid)
}
return false
}
var leftMtime, rightMtime syscall.Timespec
leftMtime.Sec = left.MtimeSeconds
leftMtime.Nsec = int64(left.MtimeNanoSeconds)
rightMtime.Sec = right.MtimeSeconds
rightMtime.Nsec = int64(right.MtimeNanoSeconds)
if leftMtime != rightMtime {
if logWriter != nil {
fmt.Fprintf(logWriter, "Mtime: left vs. right: %v vs. %v\n",
leftMtime, rightMtime)
}
return false
}
return true
}