From d55bedc271f20daf03f0c2183487494b71c8fea9 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Sun, 26 Oct 2025 16:31:06 +0300 Subject: [PATCH] Fix proper mtime's ns storage --- doc/news.texi | 7 +++++++ inode.go | 3 ++- usage.go | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/news.texi b/doc/news.texi index 4a08a68..aae9c15 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -2,6 +2,13 @@ @cindex news @unnumbered News +@anchor{Release 2_6_5} +@section Release 2.6.5 +@itemize +@item + Fix proper @command{mtime}'s nanoseconds storage. +@end itemize + @anchor{Release 2_6_4} @section Release 2.6.4 @itemize diff --git a/inode.go b/inode.go index c345fcc..9b1f995 100644 --- a/inode.go +++ b/inode.go @@ -82,8 +82,9 @@ func (inode *Inode) RecfileFields() []recfile.Field { func inodeFromFileStat(fi os.FileInfo, stat unix.Stat_t) *Inode { ctimeSec, ctimeNsec := stat.Ctim.Unix() - mtimeSec := fi.ModTime().Unix() mtimeNsec := fi.ModTime().UnixNano() + mtimeSec := mtimeNsec / 1000000000 + mtimeNsec -= mtimeSec * 1000000000 inode := new(Inode) binary.BigEndian.PutUint64(inode[0*8:1*8], uint64(fi.Size())) binary.BigEndian.PutUint64(inode[1*8:2*8], uint64(stat.Ino)) diff --git a/usage.go b/usage.go index 67ae2e7..50d53c8 100644 --- a/usage.go +++ b/usage.go @@ -22,7 +22,7 @@ import ( ) const ( - Version = "2.6.4" + Version = "2.6.5" Warranty = `Copyright (C) 2020-2025 Sergey Matveev This program is free software: you can redistribute it and/or modify -- 2.52.0