am 40d1aa50: Merge "Clarify Calendar.clear documentation."

* commit '40d1aa50b6b59f7f74ff83202174feb7bd73e41b':
  Clarify Calendar.clear documentation.
diff --git a/luni/src/main/java/java/util/Calendar.java b/luni/src/main/java/java/util/Calendar.java
index aeddc18..4ed2ad1 100644
--- a/luni/src/main/java/java/util/Calendar.java
+++ b/luni/src/main/java/java/util/Calendar.java
@@ -774,8 +774,9 @@
     }
 
     /**
-     * Clears all of the fields of this {@code Calendar}. All fields are initialized to
-     * zero.
+     * Clears the values of all the time fields, marking them all unset and assigning
+     * them all a value of zero. The actual field values will be determined the next
+     * time the fields are accessed.
      */
     public final void clear() {
         for (int i = 0; i < FIELD_COUNT; i++) {
@@ -786,7 +787,9 @@
     }
 
     /**
-     * Clears the given field to zero and sets the isSet flag to {@code false}.
+     * Clears the value in the given time field, marking it unset and assigning
+     * it a value of zero. The actual field value will be determined the next
+     * time the field is accessed.
      */
     public final void clear(int field) {
         fields[field] = 0;
diff --git a/luni/src/test/java/libcore/java/util/CalendarTest.java b/luni/src/test/java/libcore/java/util/CalendarTest.java
index 5c36fe2..b0e6b6b 100644
--- a/luni/src/test/java/libcore/java/util/CalendarTest.java
+++ b/luni/src/test/java/libcore/java/util/CalendarTest.java
@@ -205,4 +205,21 @@
         double ONE_HOUR = 3600d * 1000d;
         return c.getTimeInMillis() / ONE_HOUR;
     }
+
+    // https://code.google.com/p/android/issues/detail?id=45877
+    public void test_clear_45877() {
+      GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles"));
+      cal.set(Calendar.YEAR, 1970);
+      cal.set(Calendar.MONTH, Calendar.JANUARY);
+      cal.set(Calendar.DAY_OF_MONTH, 1);
+      cal.clear(Calendar.HOUR_OF_DAY);
+      cal.clear(Calendar.MINUTE);
+      cal.clear(Calendar.SECOND);
+      cal.clear(Calendar.MILLISECOND);
+
+      assertEquals(75600000, cal.getTimeInMillis());
+
+      cal.set (Calendar.HOUR_OF_DAY, 0);
+      assertEquals(28800000, cal.getTimeInMillis());
+    }
 }