Author: ivaynberg
Date: Fri May 30 11:20:05 2008
New Revision: 661802

URL: http://svn.apache.org/viewvc?rev=661802&view=rev
Log:
WICKET-1670

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/Time.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/Time.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/Time.java?rev=661802&r1=661801&r2=661802&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/Time.java 
(original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/time/Time.java Fri 
May 30 11:20:05 2008
@@ -28,7 +28,7 @@
  * <code>Duration</code> class. To represent a time period with a start and 
end time, use the
  * <code>TimeFrame</code> class. To represent a time of day, use the 
<code>TimeOfDay</code>
  * class.
- *
+ * 
  * @author Jonathan Locke
  * @since 1.2.6
  */
@@ -47,7 +47,7 @@
 
        /**
         * Retrieves a <code>Time</code> instance based on the given 
milliseconds.
-        *
+        * 
         * @param time
         *            the time value in milliseconds since START_OF_UNIX_TIME
         * @return the given <code>Time</code>
@@ -59,7 +59,7 @@
 
        /**
         * Retrieves a <code>Time</code> instance based on the current time.
-        *
+        * 
         * @return the current <code>Time</code>
         */
        public static Time now()
@@ -69,7 +69,7 @@
 
        /**
         * Retrieves a <code>Time</code> instance by parsing 'yyyy.MM.dd' 
format.
-        *
+        * 
         * @param calendar
         *            the <code>Calendar</code> to use when parsing date 
<code>String</code>
         * @param string
@@ -94,7 +94,7 @@
        /**
         * Retrieves a <code>Time</code> instance by parsing 'yyyy.MM.dd' 
format using a local time
         * <code>Calendar</code>.
-        *
+        * 
         * @param string
         *            the <code>String</code> to parse
         * @return the time
@@ -107,7 +107,7 @@
 
        /**
         * Retrieves a <code>Time</code> instance by parsing 'yyyy.MM.dd-h.mma' 
format.
-        *
+        * 
         * @param calendar
         *            the <code>Calendar</code> to use when parsing the 
<code>String</code>
         * @param string
@@ -131,7 +131,7 @@
        /**
         * Retrieves a <code>Time</code> instance based on the given 
<code>Calendar</code> and
         * [EMAIL PROTECTED] TimeOfDay} objects.
-        *
+        * 
         * @param calendar
         *            the <code>Calendar</code> to use
         * @param timeOfDay
@@ -147,6 +147,7 @@
                        calendar.set(Calendar.HOUR, 0);
                        calendar.set(Calendar.MINUTE, 0);
                        calendar.set(Calendar.SECOND, 0);
+                       calendar.set(Calendar.MILLISECOND, 0); // WICKET-1670
 
                        // Add time of day milliseconds to midnight
                        return valueOf(calendar.getTimeInMillis() + 
timeOfDay.getMilliseconds());
@@ -155,7 +156,7 @@
 
        /**
         * Retrieves a <code>Time</code> instance based on the given 
<code>Date</code> object.
-        *
+        * 
         * @param date
         *            a <code>java.util.Date</code> object
         * @return a corresponding immutable <code>Time</code> object
@@ -167,7 +168,7 @@
 
        /**
         * Retrieves a <code>Time</code> instance based on the given 
milliseconds.
-        *
+        * 
         * @param time
         *            the <code>Time</code> value in milliseconds since 
START_OF_UNIX_TIME
         * @return a corresponding immutable <code>Time</code> object
@@ -179,7 +180,7 @@
 
        /**
         * Retrieves a <code>Time</code> instance by parsing 'yyyy.MM.dd-h.mma' 
format.
-        *
+        * 
         * @param string
         *            the <code>String</code> to parse
         * @return the <code>Time</code> instance
@@ -192,7 +193,7 @@
 
        /**
         * Retrieves a <code>Time</code> instance by parsing 'pattern' format.
-        *
+        * 
         * @param string
         *            input
         * @param pattern
@@ -210,7 +211,7 @@
 
        /**
         * Retrieves a <code>Time</code> instance based on the given [EMAIL 
PROTECTED] TimeOfDay} object.
-        *
+        * 
         * @param timeOfDay
         *            the time of day in local time
         * @return a <code>Time</code> value for the time of day today
@@ -222,7 +223,7 @@
 
        /**
         * Private constructor forces use of static factory methods.
-        *
+        * 
         * @param time
         *            the <code>Time</code> value in milliseconds since 
START_OF_UNIX_TIME
         */
@@ -234,7 +235,7 @@
        /**
         * Adds the given <code>Duration</code> to this <code>Time</code> 
object, moving the time
         * into the future.
-        *
+        * 
         * @param duration
         *            the <code>Duration</code> to add
         * @return this <code>Time</code> + <code>Duration</code>
@@ -246,7 +247,7 @@
 
        /**
         * Calculates the amount of time that has elapsed since this 
<code>Time</code> value.
-        *
+        * 
         * @return the amount of time that has elapsed since this 
<code>Time</code> value
         * @throws IllegalStateException
         *             thrown if this <code>Time</code> value is in the future
@@ -265,7 +266,7 @@
         * Retrieves the <code>Duration</code> from now to this 
<code>Time</code> value. If this
         * <code>Time</code> value is in the past, then the 
<code>Duration</code> returned will be
         * negative. Otherwise, it will be the number of milliseconds from now 
to this <code>Time</code>.
-        *
+        * 
         * @return the <code>Duration</code> from now to this <code>Time</code> 
value
         */
        public Duration fromNow()
@@ -275,7 +276,7 @@
 
        /**
         * Retrieves the value of a field from the given <code>Calendar</code>.
-        *
+        * 
         * @param calendar
         *            the <code>Calendar</code> to use
         * @param field
@@ -294,7 +295,7 @@
 
        /**
         * Retrieves the value of a field.
-        *
+        * 
         * @param field
         *            the <code>Calendar</code> field to get
         * @return the field's value (in local time)
@@ -306,7 +307,7 @@
 
        /**
         * Retrieves the day of month field of the current 
<code>Calendar</code>.
-        *
+        * 
         * @return the day of month field value
         */
        public int getDayOfMonth()
@@ -316,7 +317,7 @@
 
        /**
         * Retrieves the day of month field of the given <code>Calendar</code>.
-        *
+        * 
         * @param calendar
         *            the <code>Calendar</code> to get the field value from
         * @return the day of month field value
@@ -328,7 +329,7 @@
 
        /**
         * Retrieves the hour field of the current <code>Calendar</code>.
-        *
+        * 
         * @return the hour field value
         */
        public int getHour()
@@ -338,7 +339,7 @@
 
        /**
         * Retrieves the hour field of the given <code>Calendar</code>.
-        *
+        * 
         * @param calendar
         *            the <code>Calendar</code> to get the field value from
         * @return the hour field value
@@ -350,7 +351,7 @@
 
        /**
         * Retrieves the minute field of the current <code>Calendar</code>.
-        *
+        * 
         * @return the minute field value
         */
        public int getMinute()
@@ -360,7 +361,7 @@
 
        /**
         * Retrieves the minute field of the given <code>Calendar</code>.
-        *
+        * 
         * @param calendar
         *            the <code>Calendar</code> from which to get the field 
value
         * @return the minute field value
@@ -372,7 +373,7 @@
 
        /**
         * Retrieves the month field of the current <code>Calendar</code>.
-        *
+        * 
         * @return the month field value
         */
        public int getMonth()
@@ -382,7 +383,7 @@
 
        /**
         * Retrieves the month field of the given <code>Calendar</code>.
-        *
+        * 
         * @param calendar
         *            the <code>Calendar</code> from which to get the field 
value
         * @return the month field value
@@ -394,7 +395,7 @@
 
        /**
         * Retrieves the seconds field of the current <code>Calendar</code>.
-        *
+        * 
         * @return the seconds field value
         */
        public int getSecond()
@@ -404,7 +405,7 @@
 
        /**
         * Retrieves the seconds field of the given <code>Calendar</code>.
-        *
+        * 
         * @param calendar
         *            the <code>Calendar</code> from which to get the field 
value
         * @return the seconds field value
@@ -416,7 +417,7 @@
 
        /**
         * Retrieves the year field of the current <code>Calendar</code>.
-        *
+        * 
         * @return the year field value
         */
        public int getYear()
@@ -426,7 +427,7 @@
 
        /**
         * Retrieves the year field of the given <code>Calendar</code>.
-        *
+        * 
         * @param calendar
         *            the <code>Calendar</code> from which to get the field 
value
         * @return the year field value
@@ -439,7 +440,7 @@
        /**
         * Subtracts the given <code>Duration</code> from this 
<code>Time</code> object, moving the
         * time into the past.
-        *
+        * 
         * @param duration
         *            the <code>Duration</code> to subtract
         * @return this duration of time
@@ -451,7 +452,7 @@
 
        /**
         * Subtract time from this and returns the difference as a 
<code>Duration</code> object.
-        *
+        * 
         * @param that
         *            the time to subtract
         * @return the <code>Duration</code> between this and that time
@@ -465,7 +466,7 @@
         * Retrieves a <code>Date</code> object for this <code>Time</code> 
object. A new
         * <code>Date</code> object is always returned rather than attempting 
to cache a date since
         * <code>Date</code> is mutable.
-        *
+        * 
         * @return this immutable <code>Time</code> object as a mutable 
<code>java.util.Date</code>
         *         object
         */
@@ -477,7 +478,7 @@
        /**
         * Converts this <code>Time</code> value to a date <code>String</code> 
using the date
         * formatter 'yyyy.MM.dd'.
-        *
+        * 
         * @return the date string
         */
        public String toDateString()
@@ -488,7 +489,7 @@
        /**
         * Converts this <code>Time</code> value to a date <code>String</code> 
using the formatter
         * 'yyyy.MM.dd'.
-        *
+        * 
         * @param calendar
         *            the <code>Calendar</code> to use in the conversion
         * @return the date <code>String</code>
@@ -509,9 +510,10 @@
        /**
         * Converts this <code>Time</code> value to a <code>String</code> 
suitable for use in a file
         * system name.
-        *
+        * 
         * @return this <code>Time</code> value as a formatted 
<code>String</code>
         */
+       @Override
        public String toString()
        {
                return toDateString() + "-" + toTimeString();
@@ -520,7 +522,7 @@
        /**
         * Converts this <code>Time</code> object to a <code>String</code> 
using the given
         * <code>Calendar</code> and format.
-        *
+        * 
         * @param calendar
         *            the <code>Calendar</code> to use in the conversion
         * @param format
@@ -536,7 +538,7 @@
 
        /**
         * Converts this <code>Time</code> value to a <code>String</code> using 
the given format.
-        *
+        * 
         * @param format
         *            the format to use
         * @return this <code>Time</code> value as a formatted string


Reply via email to