{"thread":{"id":"18854","subject":"[EGIT PATCH] Handle the case when the file timestamp in java is rounded to seconds","startedAt":"2009-04-13T20:45:00Z","lastAt":"2009-04-13T20:45:00Z","messageCount":1,"participants":["Robin Rosenberg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"111231","messageId":"1239655500-13595-1-git-send-email-robin.rosenberg@dewire.com","threadId":"18854","inReplyTo":null,"subject":"[EGIT PATCH] Handle the case when the file timestamp in java is rounded to seconds","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg@dewire.com","sentAt":"2009-04-13T20:45:00Z","receivedAt":"2009-04-13T20:45:00Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"Even if the file systems support subsecond timestamp resolution\nthe Java runtime, including the Eclipse resources may return\ntimestamps that are truncated to seconds only.\n\nSigned-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>\n---\n .../decorators/DecoratableResourceAdapter.java     |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\ndiff --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\nindex 5c68d5b..12f7ec3 100644\n--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java\n+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java\n@@ -354,8 +354,12 @@ private static boolean timestampMatches(DirCacheEntry indexEntry,\n \t\t// so we need to check to see if this is the case here, and possibly\n \t\t// fix the timestamp of the resource to match the resolution of the\n \t\t// index.\n-\t\tif (tIndex % 1000 == 0) {\n-\t\t\treturn tIndex == (tWorkspaceResource - (tWorkspaceResource % 1000));\n+\t\t// It also appears the timestamp in Java on Linux may also be rounded\n+\t\t// in which case the index timestamp may have subseconds, but not\n+\t\t// the timestamp from the workspace resource.\n+\t\t// If either timestamp looks rounded we skip the subscond part.\n+\t\tif (tIndex % 1000 == 0 || tWorkspaceResource % 1000 == 0) {\n+\t\t\treturn tIndex / 1000 == tWorkspaceResource / 1000;\n \t\t} else {\n \t\t\treturn tIndex == tWorkspaceResource;\n \t\t}\n-- \n1.6.2.2.446.gfbdc0\n"}]}