Exemple #1
0
void run_test()
{

  printf("Running test for DROTM with N = %d, incx = %d, incy = %d, flag = %f\n", N, incx, incy, param[0]);
  printf("%32s%32s\n","ACML", "FORTRAN");
  printf("Trials\n");
  printf("%32s%32s%32s\n", "Time (ns)", "Time (ns)", "ACML == FT");

  int c = 8, ic, it = 0;
  unsigned long long int tot1 = 0, tot2 = 0;
  for (ic = 0; ic < c; ic++)
  {
    unsigned long long int t1, t2;
    t1 = acml_time();
    t2 = f_time();
    printf("%32d", array_cmp());
    if (ic >= 2)
    {
      tot1 += t1;
      tot2 += t2;
      it ++;
    }
    printf("\n");
  }

  printf("Average (Does not include first two trials)\n");
  printf("%32llu%32llu\n",tot1/it,tot2/it);
  printf("\n"); 
}
Exemple #2
0
void run_test() 
{
  printf("Running test for SCNRM2 with N = %d, incx = %d\n", N, incx);
  printf("%32s%32s\n","ACML","Fortran");
  printf("Trials\n");
  printf("%32s%32s%32s\n", "Time (ns)", "Time (ns)", "ACML == FT");

  int c = 8, it = 0;
  unsigned long long int tot1 = 0, tot2 = 0;

  int ic;
  for (ic = 0; ic < c; ic++)
  {
    unsigned long long int t1, t2;
    t1 = acml_time();
    t2 = f_time();
    printf("%32d", scalar_cmp());
    if (ic >= 2)
    {
      tot1 += t1;
      tot2 += t2;
      ++it;
    }
    printf("\n");
  }

  printf("Average (Does not include first two trials)\n");
  printf("%32llu%32llu\n",tot1/it,tot2/it);
  printf("\n");
}
bool TestExtDatetime::test_time() {
  // XXX This test fails between 12:00AM and 12:59AM on 10/31/11 - 11/6/11
  // and between 11:00PM and 11:59PM on 3/6/11 - 3/12/11, we should fix this.
  // This issue appears to have something to do with how strtotime() handles
  // daylight savings time.
  int nextWeek = f_time() + (7 * 24 * 60 * 60);
  VS(f_date("Y-m-d", nextWeek),
     f_date("Y-m-d", f_strtotime("+1 week")));
  return Count(true);
}
Exemple #4
0
Variant c_DateTime::ti_createfromformat(const String& format,
                                        const String& time,
                                        CObjRef timezone /*= null_object */) {
  c_DateTime *datetime = NEWOBJ(c_DateTime);
  const auto curr = (format.find("!") != String::npos) ? 0 : f_time() ;
  datetime->m_dt = NEWOBJ(DateTime(curr, false));
  if(!datetime->m_dt->fromString(time, c_DateTimeZone::unwrap(timezone),
                                 format.data(), false)) {
    return false;
  }

  return datetime;
}
Exemple #5
0
Variant HHVM_STATIC_METHOD(DateTime, createFromFormat,
                           const String& format,
                           const String& time,
                           const Variant& timezone /*= null_variant */) {
  const Object& obj_timezone = timezone.isNull()
                             ? null_object
                             : timezone.toObject();
  Object obj{DateTimeData::getClass()};
  DateTimeData* data = Native::data<DateTimeData>(obj);
  const auto curr = (format.find("!") != String::npos) ? 0 : f_time() ;
  data->m_dt = req::make<DateTime>(curr, false);
  if (!data->m_dt->fromString(time, DateTimeZoneData::unwrap(obj_timezone),
                              format.data(), false)) {
    return false;
  }

  return obj;
}
Exemple #6
0
Variant HHVM_STATIC_METHOD(DateTime, createFromFormat,
                           const String& format,
                           const String& time,
                           const Variant& timezone /*= uninit_variant */) {
  auto tz = TimeZone::Current();
  if (!timezone.isNull()) {
    const Object& obj_timezone = timezone.toObject();
    if (!obj_timezone.instanceof(s_DateTimeZone)) {
      raise_argument_warning("DateTime::createFromFormat", 3, s_DateTimeZone,
                             obj_timezone);
      return false;
    }
    tz = DateTimeZoneData::unwrap(obj_timezone);
  }
  Object obj{DateTimeData::getClass()};
  DateTimeData* data = Native::data<DateTimeData>(obj);
  const auto curr = (format.find("!") != String::npos) ? 0 : f_time() ;
  data->m_dt = req::make<DateTime>(curr, false);
  if (!data->m_dt->fromString(time, tz, format.data(), false)) {
    return false;
  }

  return obj;
}
bool TestExtDatetime::test_time() {
  int nextWeek = f_time() + (7 * 24 * 60 * 60);
  VS(f_date("Y-m-d", nextWeek),
     f_date("Y-m-d", f_strtotime("+1 week")));
  return Count(true);
}