当前位置: 首页>>代码示例>>Golang>>正文


Golang Timespec.Nsec方法代码示例

本文整理汇总了Golang中syscall.Timespec.Nsec方法的典型用法代码示例。如果您正苦于以下问题:Golang Timespec.Nsec方法的具体用法?Golang Timespec.Nsec怎么用?Golang Timespec.Nsec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在syscall.Timespec的用法示例。


在下文中一共展示了Timespec.Nsec方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: 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
}
开发者ID:zaletniy,项目名称:Dominator,代码行数:50,代码来源:compare.go

示例2: 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
}
开发者ID:wxdublin,项目名称:Dominator,代码行数:46,代码来源:compare.go

示例3: 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
}
开发者ID:keep94,项目名称:Dominator,代码行数:40,代码来源:compare.go


注:本文中的syscall.Timespec.Nsec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。