diff options
author | Shawn Pearce <spearce@spearce.org> | 2016-11-15 17:34:07 -0800 |
---|---|---|
committer | Shawn Pearce <spearce@spearce.org> | 2016-11-21 11:34:14 -0800 |
commit | 81f9c18433f9d53a64498b07c90c4fc73654d942 (patch) | |
tree | a664218e45862de9de923e16875a6b19764b867a /org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java | |
parent | 608e31126e3ef0ff4d02e048dc5eefdb28f0b7c4 (diff) | |
download | jgit-81f9c18433f9d53a64498b07c90c4fc73654d942.tar.gz jgit-81f9c18433f9d53a64498b07c90c4fc73654d942.zip |
Define MonotonicClock interface for advanced timestamps
MonotonicClock can be implemented to provide more certainity about
time than the standard System.currentTimeMillis() can provide. This
can be used by classes such as PersonIdent and Ketch to rely on
more certainity about time moving in a strictly ascending order.
Gerrit Code Review can also leverage this interface through its
embedding of JGit and use MonotonicClock and ProposedTimestamp to
provide stronger assurance that NoteDb time is moving forward.
Change-Id: I1a3cbd49a39b150a0d49b36d572da113ca83a786
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java index e08a98529d..0deb542cfd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java @@ -53,6 +53,7 @@ import java.util.TimeZone; import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.util.SystemReader; +import org.eclipse.jgit.util.time.ProposedTimestamp; /** * A combination of a person identity and time in Git. @@ -189,6 +190,18 @@ public class PersonIdent implements Serializable { } /** + * Construct a new {@link PersonIdent} with current time. + * + * @param aName + * @param aEmailAddress + * @param when + */ + public PersonIdent(String aName, String aEmailAddress, + ProposedTimestamp when) { + this(aName, aEmailAddress, when.millis()); + } + + /** * Copy a PersonIdent, but alter the clone's time stamp * * @param pi |