javahl date/time conversions in Status.java
From: Daniel Rall <dlr_at_finemaltcoding.com>
Date: 2005-04-28 02:11:43 CEST
Patrick, I'm curious why Status's getLastChangedDate() and
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html#Date(long)
Do I misunderstand, or should I make the following change?
Thanks, Dan
---
subversion/bindings/java/javahl/src/org/tigris/subversion/javahl/Status.java (revision 14486)
+++
subversion/bindings/java/javahl/src/org/tigris/subversion/javahl/Status.java (working copy)
@@ -240,10 +240,7 @@
*/
public Date getLastChangedDate()
{
- if (lastChangedDate == 0)
- return null;
- else
- return new Date(lastChangedDate / 1000);
+ return millisToDate(lastChangedDate);
}
/**
@@ -535,10 +532,7 @@
*/
public Date getLockCreationDate()
{
- if (lockCreationDate == 0)
- return null;
- else
- return new Date(lockCreationDate / 1000);
+ return millisToDate(lockCreationDate);
}
/**
@@ -596,4 +590,15 @@
}
}
}
+
+ /**
+ * Converts a milliseconds since the epoch to a Date object.
+ *
+ * @return A Date object, or <code>null</code> if
+ * <code>millis</code> was zero.
+ */
+ private static Date millisToDate(long millis)
+ {
+ return (millis == 0 ? null : new Date(millis));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Apr 28 02:48:36 2005
|
This is an archived mail posted to the Subversion Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.