本文整理匯總了Golang中clive/zx.Dir.Time方法的典型用法代碼示例。如果您正苦於以下問題:Golang Dir.Time方法的具體用法?Golang Dir.Time怎麽用?Golang Dir.Time使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類clive/zx.Dir
的用法示例。
在下文中一共展示了Dir.Time方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: wstat
// NB: Attributes that the user can't set are always ignored.
// If the user has no permissioin to set an attribute, that's an error.
// Setting an attribute to an empty string removes it.
// Uid, Gid, and Wuid can't be removed.
// Meta locking done by caller, might lock data on truncations
func (f *mFile) wstat(d zx.Dir) error {
if len(d) == 0 {
return nil
}
d = d.Dup()
sum := ""
if f.d["type"] != "d" {
if _, ok := d["size"]; ok {
sz := d.Int64("size")
if sz < 0 {
sz = 0
}
f.data.Truncate(sz)
d["size"] = strconv.FormatInt(sz, 10)
if DoSum {
sum = f.data.Sum()
}
}
} else {
delete(d, "size")
}
if _, ok := d["mode"]; ok {
mode := d.Int("mode")&0777
d["mode"] = "0" + strconv.FormatInt(int64(mode), 8)
}
if _, ok := d["mtime"]; ok {
d.SetTime("mtime", d.Time("mtime"))
}
if sum != "" {
f.d["Sum"] = sum
}
ud := d.UsrAttrs()
if d["Wuid"] != "" {
ud["Wuid"] = d["Wuid"]
}
for k, v := range ud {
if v == "" {
delete(f.d, k)
} else {
f.d[k] = v
}
}
return nil
}