]> source.dussan.org Git - jgit.git/commitdiff
DirCacheEntry: accessors for cached creation time (CTIME) 50/4450/1
authorMarc Strapetz <marc.strapetz@syntevo.com>
Mon, 31 Oct 2011 16:45:51 +0000 (17:45 +0100)
committerMarc Strapetz <marc.strapetz@syntevo.com>
Mon, 31 Oct 2011 16:45:51 +0000 (17:45 +0100)
Change-Id: I986d5fff63ff1a86cca6bab49c744ea673fe4892

org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java

index defab97a08621a472c41e363620f2431df341288..2ea79ad6e60efc61cbfc9ade7962a9a73c18ea40 100644 (file)
@@ -86,7 +86,7 @@ public class DirCacheEntry {
        /** The second tree revision (usually called "theirs"). */
        public static final int STAGE_3 = 3;
 
-       // private static final int P_CTIME = 0;
+       private static final int P_CTIME = 0;
 
        // private static final int P_CTIME_NSEC = 4;
 
@@ -479,6 +479,26 @@ public class DirCacheEntry {
                NB.encodeInt32(info, infoOffset + P_MODE, mode.getBits());
        }
 
+       /**
+        * Get the cached creation time of this file, in milliseconds.
+        *
+        * @return cached creation time of this file, in milliseconds since the
+        *         Java epoch (midnight Jan 1, 1970 UTC).
+        */
+       public long getCreationTime() {
+               return decodeTS(P_CTIME);
+       }
+
+       /**
+        * Set the cached creation time of this file, using milliseconds.
+        *
+        * @param when
+        *            new cached creation time of the file, in milliseconds.
+        */
+       public void setCreationTime(final long when) {
+               encodeTS(P_CTIME, when);
+       }
+
        /**
         * Get the cached last modification date of this file, in milliseconds.
         * <p>