git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[EGIT PATCH] Handle the case when the file timestamp in java is rounded to seconds

From
Robin Rosenberg <robin.rosenberg@dewire.com>
Date
Apr 13, 2009, 20:45 UTC
Message-ID
<1239655500-13595-1-git-send-email-robin.rosenberg@dewire.com>

Even if the file systems support subsecond timestamp resolution the Java runtime, including the Eclipse resources may return timestamps that are truncated to seconds only.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../decorators/DecoratableResourceAdapter.java     |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java
index 5c68d5b..12f7ec3 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java
@@ -354,8 +354,12 @@ private static boolean timestampMatches(DirCacheEntry indexEntry,
 		// so we need to check to see if this is the case here, and possibly
 		// fix the timestamp of the resource to match the resolution of the
 		// index.
-		if (tIndex % 1000 == 0) {
-			return tIndex == (tWorkspaceResource - (tWorkspaceResource % 1000));
+		// It also appears the timestamp in Java on Linux may also be rounded
+		// in which case the index timestamp may have subseconds, but not
+		// the timestamp from the workspace resource.
+		// If either timestamp looks rounded we skip the subscond part.
+		if (tIndex % 1000 == 0 || tWorkspaceResource % 1000 == 0) {
+			return tIndex / 1000 == tWorkspaceResource / 1000;
 		} else {
 			return tIndex == tWorkspaceResource;
 		}
-- 
1.6.2.2.446.gfbdc0
Message 1 of 1 in “Handle the case when the file timestamp in java is rounded to seconds”
  1. Handle the case when the file timestamp in java is rounded to secondsRobin Rosenberg, Apr 13, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.