summaryrefslogtreecommitdiff
path: root/lib/util.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2014-09-09 12:24:37 +0100
committerColin Watson <cjwatson@debian.org>2014-09-11 12:53:28 +0100
commit8cabdfbf42bdb94bdc500ae4463d0e498349946f (patch)
tree1a5153560a87ceecfde9048d862c185a63efe267 /lib/util.c
parentd9ebedad152816ea2ee8725a0ee1b0f80f7aeb46 (diff)
Use high-precision timestamps for manual pages
* lib/util.c (is_changed): Compare high-precision timestamps. * libdb/db_storage.h (FIELDS): Increment to 10. (struct mandata): Change "time_t _st_mtime" to "struct timespec mtime". * libdb/db_lookup.c (dbprintf): Update mtime display. (split_content): Store two fields for the mtime (seconds and nanoseconds). (make_content): Expect two fields for the mtime. * libdb/db_store.c (replace_if_necessary): Compare high-precision timestamps. * src/check_mandirs.c (test_manfile): Likewise. * src/man.c (maybe_update_file): Likewise. * src/straycats.c (check_for_stray): Update initialisation of struct mandata. * src/tests/testlib.sh (accessdb_filter): Adjust for new format. * manual/db.me (Contents of an index database): Describe new format. (Example database): Update example output. * NEWS: Document this.
Diffstat (limited to 'lib/util.c')
-rw-r--r--lib/util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/util.c b/lib/util.c
index 978a16e4..faa5d643 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -44,6 +44,8 @@
#include <unistd.h>
#include <locale.h>
+#include "stat-time.h"
+#include "timespec.h"
#include "xvasprintf.h"
#include "gettext.h"
@@ -97,7 +99,8 @@ int is_changed (const char *fa, const char *fb)
if (fb_sb.st_size == 0)
status |= 4;
- status |= (fa_sb.st_mtime != fb_sb.st_mtime);
+ status |= (timespec_cmp (get_stat_mtime (&fa_sb),
+ get_stat_mtime (&fb_sb)) != 0);
debug (" (%d)\n", status);
return status;