nsCRT::memset( &tmTime, 0, sizeof(tmTime) );
NS_IMETHODIMP nsScriptableDateFormat::FormatDateTime(                            const PRUnichar *locale,                             nsDateFormatSelector dateFormatSelector,                             nsTimeFormatSelector timeFormatSelector,                             PRInt32 year,                             PRInt32 month,                             PRInt32 day,                             PRInt32 hour,                             PRInt32 minute,                             PRInt32 second,                             const PRUnichar **dateTimeString){	nsILocaleFactory* localeFactory; 	nsILocale* aLocale; 	nsString localeName(locale);  nsresult rv;  *dateTimeString = NULL;  // get a locale factory 	rv = nsComponentManager::FindFactory(kLocaleFactoryCID, (nsIFactory**)&localeFactory);   if (NS_SUCCEEDED(rv) && localeFactory) {    rv = localeName.Length() ? localeFactory->NewLocale(&localeName, &aLocale) :                               localeFactory->GetApplicationLocale(&aLocale);    if (NS_SUCCEEDED(rv) && aLocale) {      nsIDateTimeFormat *aDateTimeFormat;    	rv = nsComponentManager::CreateInstance(kDateTimeFormatCID, NULL,                                              nsIDateTimeFormat::GetIID(), (void **) &aDateTimeFormat);      if (NS_SUCCEEDED(rv) && aDateTimeFormat) {        struct tm tmTime;        time_t  timetTime;        tmTime.tm_year = year - 1900;        tmTime.tm_mon = month - 1;        tmTime.tm_mday = day;        tmTime.tm_hour = hour;        tmTime.tm_min = minute;        tmTime.tm_sec = second;        tmTime.tm_yday = tmTime.tm_wday = 0;        tmTime.tm_isdst = -1;        timetTime = mktime(&tmTime);        if (-1 != timetTime) {          rv = aDateTimeFormat->FormatTime(aLocale, dateFormatSelector, timeFormatSelector,                           timetTime, mStringOut);          if (NS_SUCCEEDED(rv)) {            *dateTimeString = mStringOut.GetUnicode();          }        }        else {          rv = NS_ERROR_ILLEGAL_VALUE; // invalid arg value        }        NS_RELEASE(aDateTimeFormat);      }      NS_RELEASE(aLocale);    }    NS_RELEASE(localeFactory);  }  return rv;}