cout << "\tnsIScriptableDateFormat CreateInstance failed\n";
printf("\tnsIScriptableDateFormat CreateInstance failed\n");
static void TestDateTimeFormat(nsILocale *locale){  nsresult res;  cout << "==============================\n";  cout << "Start nsIScriptableDateFormat Test \n";  cout << "==============================\n";  nsIScriptableDateFormat *aScriptableDateFormat;  res = nsComponentManager::CreateInstance(kDateTimeFormatCID,                                           NULL,                                           NS_GET_IID(nsIScriptableDateFormat),                                           (void**) &aScriptableDateFormat);  if(NS_FAILED(res) || ( aScriptableDateFormat == NULL ) ) {    cout << "\tnsIScriptableDateFormat CreateInstance failed\n";  }  PRUnichar *aUnichar;  nsString aString;  PRUnichar aLocaleUnichar[1];  *aLocaleUnichar = 0;  res = aScriptableDateFormat->FormatDateTime(aLocaleUnichar, kDateFormatShort, kTimeFormatSeconds,                        1999,                         7,                         31,                         8,                         21,                         58,                        &aUnichar);  aString.SetString(aUnichar);  DebugDump(aString, cout);  res = aScriptableDateFormat->FormatDate(aLocaleUnichar, kDateFormatLong,                        1970,                         4,                         20,                         &aUnichar);  aString.SetString(aUnichar);  DebugDump(aString, cout);  res = aScriptableDateFormat->FormatTime(aLocaleUnichar, kTimeFormatSecondsForce24Hour,                        13,                         59,                         31,                        &aUnichar);  aString.SetString(aUnichar);  DebugDump(aString, cout);  aScriptableDateFormat->Release();  cout << "==============================\n";  cout << "Start nsIDateTimeFormat Test \n";  cout << "==============================\n";  nsIDateTimeFormat *t = NULL;  res = nsComponentManager::CreateInstance(kDateTimeFormatCID,                                           NULL,                                           NS_GET_IID(nsIDateTimeFormat),                                           (void**) &t);         cout << "Test 1 - CreateInstance():\n";  if(NS_FAILED(res) || ( t == NULL ) ) {    cout << "\t1st CreateInstance failed\n";  } else {    t->Release();  }  res = nsComponentManager::CreateInstance(kDateTimeFormatCID,                                           NULL,                                           NS_GET_IID(nsIDateTimeFormat),                                           (void**) &t);         if(NS_FAILED(res) || ( t == NULL ) ) {    cout << "\t2nd CreateInstance failed\n";  } else {  }  nsAutoString dateString;//  nsString locale("en-GB");  time_t  timetTime;  cout << "Test 2 - FormatTime():\n";  time( &timetTime );  res = t->FormatTime(locale, kDateFormatShort, kTimeFormatSeconds, timetTime, dateString);  DebugDump(dateString, cout);  cout << "Test 3 - FormatTMTime():\n";  time_t ltime;  time( &ltime );  // try (almost) all format combination  res = t->FormatTMTime(locale, kDateFormatNone, kTimeFormatNone, localtime( &ltime ), dateString);  cout << "kDateFormatNone, kTimeFormatNone:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatNone, kTimeFormatSeconds, localtime( &ltime ), dateString);  cout << "kDateFormatNone, kTimeFormatSeconds:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatNone, kTimeFormatNoSeconds, localtime( &ltime ), dateString);  cout << "kDateFormatNone, kTimeFormatNoSeconds:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatLong, kTimeFormatNone, localtime( &ltime ), dateString);  cout << "kDateFormatLong, kTimeFormatNone:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatLong, kTimeFormatSeconds, localtime( &ltime ), dateString);  cout << "kDateFormatLong, kTimeFormatSeconds:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatLong, kTimeFormatNoSeconds, localtime( &ltime ), dateString);  cout << "kDateFormatLong, kTimeFormatNoSeconds:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatShort, kTimeFormatNone, localtime( &ltime ), dateString);  cout << "kDateFormatShort, kTimeFormatNone:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatShort, kTimeFormatSeconds, localtime( &ltime ), dateString);  cout << "kDateFormatShort, kTimeFormatSeconds:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatShort, kTimeFormatNoSeconds, localtime( &ltime ), dateString);  cout << "kDateFormatShort, kTimeFormatNoSeconds:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatYearMonth, kTimeFormatNone, localtime( &ltime ), dateString);  cout << "kDateFormatYearMonth, kTimeFormatNone:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatYearMonth, kTimeFormatSeconds, localtime( &ltime ), dateString);  cout << "kDateFormatYearMonth, kTimeFormatSeconds:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatYearMonth, kTimeFormatNoSeconds, localtime( &ltime ), dateString);  cout << "kDateFormatYearMonth, kTimeFormatNoSeconds:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatWeekday, kTimeFormatNone, localtime( &ltime ), dateString);  cout << "kDateFormatWeekday, kTimeFormatNone:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatWeekday, kTimeFormatSeconds, localtime( &ltime ), dateString);  cout << "kDateFormatWeekday, kTimeFormatSeconds:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatWeekday, kTimeFormatNoSeconds, localtime( &ltime ), dateString);  cout << "kDateFormatWeekday, kTimeFormatNoSeconds:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatWeekday, kTimeFormatSecondsForce24Hour, localtime( &ltime ), dateString);  cout << "kDateFormatWeekday, kTimeFormatSecondsForce24Hour:\n";  DebugDump(dateString, cout);  res = t->FormatTMTime(locale, kDateFormatWeekday, kTimeFormatNoSecondsForce24Hour, localtime( &ltime ), dateString);  cout << "kDateFormatWeekday, kTimeFormatNoSecondsForce24Hour:\n";  DebugDump(dateString, cout);  res = t->Release();    cout << "==============================\n";  cout << "Finish nsIDateTimeFormat Test \n";  cout << "==============================\n";}