- TimeZone *tz = new SimpleTimeZone(-18000000 + 3600000, "Montreal(FIXED)");
-
- GregorianCalendar *cal = new GregorianCalendar(tz->clone(), Locale::getUS(), status);
- GregorianCalendar *cal2 = new GregorianCalendar(tz->clone(), Locale::getUS(), status);
- cal->clear();
- cal->set(UCAL_YEAR, 2001);
- cal->set(UCAL_MONTH, UCAL_APRIL);
- cal->set(UCAL_DAY_OF_MONTH, 1);
- cal->set(UCAL_HOUR_OF_DAY, 12); // must be near local noon for getSunRiseSet to work
-
- DateFormat *df_t = DateFormat::createTimeInstance(DateFormat::MEDIUM,Locale::getUS());
- DateFormat *df_d = DateFormat::createDateInstance(DateFormat::MEDIUM,Locale::getUS());
- DateFormat *df_dt = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::MEDIUM, Locale::getUS());
- if(!df_t || !df_d || !df_dt) {
- dataerrln("couldn't create dateformats.");
- return;
+ SimpleTimeZone tz(-18000000 + 3600000, "Montreal(FIXED)");
+
+ GregorianCalendar cal(tz.clone(), Locale::getUS(), status);
+ GregorianCalendar cal2(tz.clone(), Locale::getUS(), status);
+ cal.clear();
+ cal.set(UCAL_YEAR, 2001);
+ cal.set(UCAL_MONTH, UCAL_APRIL);
+ cal.set(UCAL_DAY_OF_MONTH, 1);
+ cal.set(UCAL_HOUR_OF_DAY, 12); // must be near local noon for getSunRiseSet to work
+
+ LocalPointer<DateFormat> df_t(DateFormat::createTimeInstance(DateFormat::MEDIUM,Locale::getUS()));
+ LocalPointer<DateFormat> df_d(DateFormat::createDateInstance(DateFormat::MEDIUM,Locale::getUS()));
+ LocalPointer<DateFormat> df_dt(DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::MEDIUM, Locale::getUS()));
+ if(!df_t.isValid() || !df_d.isValid() || !df_dt.isValid()) {
+ dataerrln("couldn't create dateformats.");
+ closeAstro(status);
+ return;