예제 #1
0
static void
delete_timer (Lisp_Timer *t)
{
    Lisp_Timer **x;
    sigset_t old;

    sigprocmask (SIG_BLOCK, &alrm_sigset, &old);
    t->deleted = 1;
    x = &timer_chain;
    while (*x != 0 && (*x) != t)
	x = &((*x)->next);
    if (*x == t)
    {
	if (t->next != 0)
	{
	    t->next->rel_msecs += t->rel_msecs;
	    t->next->rel_secs += t->rel_secs;
	    fix_time (&t->next->rel_secs, &t->next->rel_msecs);
	}
	t->rel_secs = t->rel_msecs = 0;
	*x = t->next;
	if (x == &timer_chain)
	    setup_next_timer ();
    }
    sigprocmask (SIG_SETMASK, &old, 0);
}
예제 #2
0
Glib::RefPtr< ImagePool::Study > create_query_study(DcmDataset* dset, const std::string& server) {
	Glib::RefPtr< ImagePool::Study > result = Glib::RefPtr< ImagePool::Study >(new Study);

	Glib::RefPtr< ImagePool::Instance > item = Instance::create(dset);

	result->m_server = server;
	result->m_studyinstanceuid = item->studyinstanceuid();
	result->m_patientsname = item->patientsname();
	result->m_patientsbirthdate = item->patientsbirthdate();
	result->m_patientssex = item->patientssex();
	result->m_studydescription = item->studydescription();
	result->m_studydate = item->studydate();
	result->m_studytime = item->studytime();

	if(item->studyrelatedinstances() != -1) {
		result->set_instancecount(-1, item->studyrelatedinstances());
	}
	if(item->studyrelatedseries() != -1) {
		result->set_seriescount(item->studyrelatedseries());
	}

	fix_date(result->m_patientsbirthdate);
	fix_date(result->m_studydate);
	fix_time(result->m_studytime);

	return result;
}
예제 #3
0
파일: arscan.c 프로젝트: mariuz/haiku
static int
VMS_get_member_info (struct dsc$descriptor_s *module, unsigned long *rfa)
{
  int status, i;
  long int fnval;

  time_t val;

  static struct dsc$descriptor_s bufdesc =
    { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };

  struct mhddef *mhd;
  char filename[128];

  bufdesc.dsc$a_pointer = filename;
  bufdesc.dsc$w_length = sizeof (filename);

  status = lbr$set_module (&VMS_lib_idx, rfa, &bufdesc,
			   &bufdesc.dsc$w_length, 0);
  if (! (status & 1))
    {
      error (NILF, _("lbr$set_module failed to extract module info, status = %d"),
	     status);

      lbr$close (&VMS_lib_idx);

      return 0;
    }

  mhd = (struct mhddef *) filename;

#ifdef __DECC
  /* John Fowler <*****@*****.**> writes this is needed in his environment,
   * but that decc$fix_time() isn't documented to work this way.  Let me
   * know if this causes problems in other VMS environments.
   */
  val = decc$fix_time (&mhd->mhd$l_datim) + timezone - daylight*3600;
#endif

  for (i = 0; i < module->dsc$w_length; i++)
    filename[i] = _tolower ((unsigned char)module->dsc$a_pointer[i]);

  filename[i] = '\0';

  VMS_member_date = (time_t) -1;

  fnval =
    (*VMS_function) (-1, filename, 0, 0, 0, 0, val, 0, 0, 0,
		     VMS_saved_memname);

  if (fnval)
    {
      VMS_member_date = fnval;
      return 0;
    }
  else
    return 1;
}
예제 #4
0
uint8_t add_clock_time_to_time(time_ref timestamp, uint16_t fast_time){
	if(!timestamp) return FAILURE;
	if(!fast_time) return FAILURE;

	timestamp->clock_time += fast_time;

	fix_time(timestamp);

	return SUCCESS;
}
예제 #5
0
/* Time conversion from VMS to Unix
   Conversion from local time (stored in library) to GMT (needed for gmake)
   Note: The tm_gmtoff element is a VMS extension to the ANSI standard. */
static time_t
vms_time_to_unix(void *vms_time)
{
  struct tm *tmp;
  time_t unix_time;

  unix_time = decc$fix_time(vms_time);
  tmp = localtime(&unix_time);
  unix_time -= tmp->tm_gmtoff;

  return unix_time;
}
예제 #6
0
static void
insert_timer (Lisp_Timer *t)
{
    sigset_t old;
    sigprocmask (SIG_BLOCK, &alrm_sigset, &old);
    if (t->secs > 0 || t->msecs > 0)
    {
	Lisp_Timer **x;
	t->rel_secs = t->secs;
	t->rel_msecs = t->msecs;
	t->fired = 0;
	t->deleted = 0;
	x = &timer_chain;
	while (*x != 0
	       && ((*x)->rel_secs < t->rel_secs
		   || ((*x)->rel_secs == t->rel_secs
		       && (*x)->rel_msecs <= t->rel_msecs)))
	{
	    t->rel_msecs -= (*x)->rel_msecs;
	    t->rel_secs -= (*x)->rel_secs;
	    fix_time (&t->rel_secs, &t->rel_msecs);
	    x = &((*x)->next);
	}
	if (*x != 0)
	{
	    (*x)->rel_msecs -= t->rel_msecs;
	    (*x)->rel_secs -= t->rel_secs;
	    fix_time (&(*x)->rel_secs, &(*x)->rel_msecs);
	}
	t->next = *x;
	*x = t;
	if (timer_chain == t)
	    setup_next_timer ();
    }
    sigprocmask (SIG_SETMASK, &old, 0);
}
예제 #7
0
uint8_t add_time_to_time(time_ref result_time, time_ref add_time) {
	if(!result_time) return FAILURE;
	if(!add_time) return FAILURE;

	result_time->clock_time += add_time->clock_time;
	result_time->milliseconds += add_time->milliseconds;
	result_time->seconds += add_time->seconds;
	result_time->minutes += add_time->minutes;
	result_time->hours += add_time->hours;
	result_time->days += add_time->days;

	fix_time(result_time);

	return SUCCESS;
}
예제 #8
0
uint8_t time_set_to_sum(time_ref dest, time_ref a, time_ref b) {
	if(!dest) return FAILURE;
	if(!a) return FAILURE;
	if(!b) return FAILURE;

	dest->clock_time = a->clock_time + b->clock_time;
	dest->milliseconds = a->milliseconds + b->milliseconds;
	dest->seconds = a->seconds + b->seconds;
	dest->minutes = a->minutes + b->minutes;
	dest->hours = a->hours + b->hours;
	dest->days = a->days + b->days;

	fix_time(dest);

	return SUCCESS;
}
예제 #9
0
Glib::RefPtr< ImagePool::Series > create_query_series(DcmDataset* dset) {
	Glib::RefPtr< ImagePool::Series > result = Glib::RefPtr< ImagePool::Series >(new Series);

	OFString seriesUID;
	OFString desc;
	OFString ofstr;

	dset->findAndGetOFString(DCM_SeriesInstanceUID, seriesUID);
	dset->findAndGetOFString(DCM_SeriesDescription, desc);
	if(result->m_description.empty()) {
		dset->findAndGetOFString(DCM_StudyDescription, desc);
	}
	result->m_seriesinstanceuid = seriesUID.c_str();
    result->m_description = desc.c_str();

	if(result->m_description.empty()) {
		result->m_description = gettext("no description");
	}

	dset->findAndGetOFString(DCM_Modality, ofstr);
	result->m_modality = ofstr.c_str();

	dset->findAndGetOFString(DCM_SeriesTime, ofstr);
	result->m_seriestime = ofstr.c_str();
	if(result->m_seriestime.empty()) {
		dset->findAndGetOFString(DCM_StudyTime, ofstr);
		result->m_seriestime = ofstr.c_str();
	}

	dset->findAndGetOFString(DCM_StationName, ofstr);
    result->m_stationname = ofstr.c_str();

	dset->findAndGetOFString(DCM_NumberOfSeriesRelatedInstances, ofstr);
	int i = atoi(ofstr.c_str());
	if(i != 0) {
		result->m_instancecount = i;
	}

	fix_time(result->m_seriestime);

	return result;
}
예제 #10
0
파일: arscan.c 프로젝트: Distrotech/make
static int
VMS_get_member_info (struct dsc$descriptor_s *module, unsigned long *rfa)
{
  int status, i;
  long int fnval;

  time_t val;

  static struct dsc$descriptor_s bufdesc =
    { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };

  struct mhddef *mhd;
  char filename[128];

  bufdesc.dsc$a_pointer = filename;
  bufdesc.dsc$w_length = sizeof (filename);

  status = lbr$set_module (&VMS_lib_idx, rfa, &bufdesc,
                           &bufdesc.dsc$w_length, 0);
  if (! (status & 1))
    {
      ON (error, NILF,
          _("lbr$set_module() failed to extract module info, status = %d"),
          status);

      lbr$close (&VMS_lib_idx);

      return 0;
    }

  mhd = (struct mhddef *) filename;

#ifdef __DECC
  /* John Fowler <*****@*****.**> writes this is needed in his environment,
   * but that decc$fix_time() isn't documented to work this way.  Let me
   * know if this causes problems in other VMS environments.
   */
  {
    /* Modified by M. Gehre at 11-JAN-2008 because old formula is wrong:
     * val = decc$fix_time (&mhd->mhd$l_datim) + timezone - daylight*3600;
     * a) daylight specifies, if the timezone has daylight saving enabled, not
     *    if it is active
     * b) what we need is the information, if daylight saving was active, if
     *    the library module was replaced. This information we get using the
     *    localtime function
     */

    struct tm *tmp;

    /* Conversion from VMS time to C time */
    val = decc$fix_time (&mhd->mhd$l_datim);

    /*
     * Conversion from local time (stored in library) to GMT (needed for gmake)
     * Note: The tm_gmtoff element is a VMS extension to the ANSI standard.
     */
    tmp = localtime (&val);
    val -= tmp->tm_gmtoff;
  }
#endif

  for (i = 0; i < module->dsc$w_length; i++)
    filename[i] = _tolower ((unsigned char)module->dsc$a_pointer[i]);

  filename[i] = '\0';

  VMS_member_date = (time_t) -1;

  fnval =
    (*VMS_function) (-1, filename, 0, 0, 0, 0, val, 0, 0, 0,
                     VMS_saved_memname);

  if (fnval)
    {
      VMS_member_date = fnval;
      return 0;
    }
  else
    return 1;
}