void CalendarRegressionTest::test4083167()
{
    UErrorCode status = U_ZERO_ERROR;
    TimeZone *saveZone = TimeZone::createDefault();
    //try {
    TimeZone *newZone = TimeZone::createTimeZone("UTC");
    TimeZone::setDefault(*newZone);
    UDate firstDate = Calendar::getNow();
        Calendar *cal = new GregorianCalendar(status);
        if(U_FAILURE(status)) {
          dataerrln("Error creating Calendar: %s", u_errorName(status));
          delete cal;
          return;
        }
        cal->setTime(firstDate,status);
        int32_t hr        = cal->get(UCAL_HOUR_OF_DAY, status);
        int32_t min        = cal->get(UCAL_MINUTE, status);
        int32_t sec        = cal->get(UCAL_SECOND, status);
        int32_t msec    = cal->get(UCAL_MILLISECOND, status);
        double firstMillisInDay = hr * 3600000 + min * 60000 + sec * 1000 + msec;

        //logln("Current time: " + firstDate.toString());

        for (int32_t validity=0; validity<30; validity++) {
            UDate lastDate = firstDate + validity*1000*24*60*60.0;
            cal->setTime(lastDate, status);
            hr        = cal->get(UCAL_HOUR_OF_DAY, status);
            min        = cal->get(UCAL_MINUTE, status);
            sec        = cal->get(UCAL_SECOND, status);
            msec    = cal->get(UCAL_MILLISECOND, status);
            double millisInDay = hr * 3600000.0 + min * 60000.0 + sec * 1000.0 + msec;
            if (firstMillisInDay != millisInDay)
                errln(UnicodeString("Day has shifted ") + lastDate);
        }
    //}
    //finally {
        TimeZone::setDefault(*saveZone);
    //}

    delete saveZone;
    delete newZone;
    delete cal;
}
void CalendarRegressionTest::test4083167()
{
    UErrorCode status = U_ZERO_ERROR;
    TimeZone *saveZone = TimeZone::createDefault();
     
    TimeZone *newZone = TimeZone::createTimeZone("UTC");
    TimeZone::setDefault(*newZone);
    UDate firstDate = Calendar::getNow();
        Calendar *cal = new GregorianCalendar(status);
        if(U_FAILURE(status)) {
          dataerrln("Error creating Calendar: %s", u_errorName(status));
          delete cal;
          return;
        }
        cal->setTime(firstDate,status);
        int32_t hr        = cal->get(UCAL_HOUR_OF_DAY, status);
        int32_t min        = cal->get(UCAL_MINUTE, status);
        int32_t sec        = cal->get(UCAL_SECOND, status);
        int32_t msec    = cal->get(UCAL_MILLISECOND, status);
        double firstMillisInDay = hr * 3600000 + min * 60000 + sec * 1000 + msec;

         

        for (int32_t validity=0; validity<30; validity++) {
            UDate lastDate = firstDate + validity*1000*24*60*60.0;
            cal->setTime(lastDate, status);
            hr        = cal->get(UCAL_HOUR_OF_DAY, status);
            min        = cal->get(UCAL_MINUTE, status);
            sec        = cal->get(UCAL_SECOND, status);
            msec    = cal->get(UCAL_MILLISECOND, status);
            double millisInDay = hr * 3600000.0 + min * 60000.0 + sec * 1000.0 + msec;
            if (firstMillisInDay != millisInDay)
                errln(UnicodeString("Day has shifted ") + lastDate);
        }
     
     
        TimeZone::setDefault(*saveZone);
     

    delete saveZone;
    delete newZone;
    delete cal;
}