From 7dfbd363a2492dc5a2fa873617791efc01c7a85e Mon Sep 17 00:00:00 2001 From: Sandy Xu Date: Mon, 1 Apr 2024 22:21:46 +0800 Subject: [PATCH] meta/sql: fix nanosecond part in Write (#4618) --- pkg/meta/sql.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/meta/sql.go b/pkg/meta/sql.go index 5ce756340b96..762f199ca954 100644 --- a/pkg/meta/sql.go +++ b/pkg/meta/sql.go @@ -2253,10 +2253,10 @@ func (m *dbMeta) Write(ctx Context, inode Ino, indx uint32, off uint32, slice Sl return err } nodeAttr.Mtime = mtime.UnixNano() / 1e3 - nodeAttr.Mtimensec = int16(mtime.Nanosecond()) + nodeAttr.Mtimensec = int16(mtime.Nanosecond() % 1e3) ctime := time.Now() nodeAttr.Ctime = ctime.UnixNano() / 1e3 - nodeAttr.Ctimensec = int16(ctime.Nanosecond()) + nodeAttr.Ctimensec = int16(ctime.Nanosecond() % 1e3) var ck = chunk{Inode: inode, Indx: indx} ok, err = s.ForUpdate().MustCols("indx").Get(&ck)