void log_request(request_t *req, char* logfile) {
	int fd;
	char buffer[1024];
	char date_buffer[80];
	char ip_buffer[40];
	date_string(date_buffer, sizeof(date_buffer));
	ip_addr_string(req->sockaddr, ip_buffer, sizeof(ip_buffer));
	snprintf(buffer, sizeof(buffer),
			 "%s\t%s\t%s\t%s\n",
			 date_buffer, ip_buffer, req->request_line, req->resp_string);
	printf("%s\n", req->request_line);
	pthread_mutex_lock(&log_lock);
	if ((fd = open(logfile, O_WRONLY | O_APPEND | O_CREAT, 0644)) == -1) {
		printf("Failed to open log file for writing.\n");
	}
	if (write(fd, buffer, strlen(buffer)) == -1) {
		if (errno == EAGAIN) {
			printf("EAGAIN\n");
		} else if (errno == EWOULDBLOCK) {
			printf("EWOULDBLOCK\n");
		} else if (errno == EBADF) {
			printf("EBADF\n");
		}
		printf("Failed to write log file.\n");
	}
	close(fd);
	pthread_mutex_unlock(&log_lock);
}
Exemplo n.º 2
0
int parse_date(const char *date, char *result, int maxlen)
{
	unsigned long timestamp;
	int offset;
	if (parse_date_basic(date, &timestamp, &offset))
		return -1;
	return date_string(timestamp, offset, result, maxlen);
}
Exemplo n.º 3
0
Arquivo: date.c Projeto: Brian1176/git
int parse_date(const char *date, struct strbuf *result)
{
	unsigned long timestamp;
	int offset;
	if (parse_date_basic(date, &timestamp, &offset))
		return -1;
	date_string(timestamp, offset, result);
	return 0;
}
Exemplo n.º 4
0
Arquivo: date.c Projeto: Brian1176/git
void datestamp(struct strbuf *out)
{
	time_t now;
	int offset;

	time(&now);

	offset = tm_to_time_t(localtime(&now)) - now;
	offset /= 60;

	date_string(now, offset, out);
}
Exemplo n.º 5
0
void datestamp(char *buf, int bufsize)
{
	time_t now;
	int offset;

	time(&now);

	offset = tm_to_time_t(localtime(&now)) - now;
	offset /= 60;

	date_string(now, offset, buf, bufsize);
}
Exemplo n.º 6
0
/* Gr. strptime is crap for this; it doesn't have a way to require RFC2822
   (i.e. English) day/month names, and it doesn't work correctly with %z. */
int parse_date(const char *date, char *result, int maxlen)
{
	struct tm tm;
	int offset, tm_gmt;
	time_t then;

	memset(&tm, 0, sizeof(tm));
	tm.tm_year = -1;
	tm.tm_mon = -1;
	tm.tm_mday = -1;
	tm.tm_isdst = -1;
	offset = -1;
	tm_gmt = 0;

	for (;;) {
		int match = 0;
		unsigned char c = *date;

		/* Stop at end of string or newline */
		if (!c || c == '\n')
			break;

		if (isalpha(c))
			match = match_alpha(date, &tm, &offset);
		else if (isdigit(c))
			match = match_digit(date, &tm, &offset, &tm_gmt);
		else if ((c == '-' || c == '+') && isdigit(date[1]))
			match = match_tz(date, &offset);

		if (!match) {
			/* BAD CRAP */
			match = 1;
		}

		date += match;
	}

	/* mktime uses local timezone */
	then = tm_to_time_t(&tm);
	if (offset == -1)
		offset = (then - mktime(&tm)) / 60;

	if (then == -1)
		return -1;

	if (!tm_gmt)
		then -= offset * 60;
	return date_string(then, offset, result, maxlen);
}
Exemplo n.º 7
0
static int build_received(str* s, str *seqno)
{
  if (!str_cats(s, "Received: from ")) return 0;
  if (!str_catfromby(s, session_getstr("helo_domain"),
		     remote_host, remote_ip))
    return 0;
  if (!str_cats(s, "\n  by ")) return 0;
  if (!str_catfromby(s, local_host, 0, local_ip)) return 0;
  if (!str_cat4s(s, "\n  with ", session_protocol(),
		 " via ", linkproto))
    return 0;
  if (!str_cat4s(s, " port ", remote_port, "/", local_port)) return 0;
  if (!str_cat2s(s, " id ", seqno->s)) return 0;
  if (!str_cat3s(s, "; ", date_string(), "\n")) return 0;
  return 1;
}
Exemplo n.º 8
0
std::string
AutonetworkerLog::get_timestamp()
{
  struct timeval tp;
  gettimeofday(&tp, NULL);
  time_t time_sec = tp.tv_sec;
  time_t time_usec = tp.tv_usec;
  struct tm *clock = localtime(&time_sec);
  char buf[128];
  strftime(buf, sizeof(buf), "%F %T", clock);
  std::string date_string(buf);
  date_string += ".";
  date_string += itoa(time_usec);
  while (date_string.length() < 26) {
    date_string += "0";
  }
  return date_string;
}
Exemplo n.º 9
0
// Build version string
void build_version_string(char *buf,short ver,short rev,long days,short format)
{
	char datebuf[20];

	// Build version string
	lsprintf(buf,"%ld.%ld",ver,rev);

	// Got date?
	if (days)
	{
		// Get date string
		datebuf[0]=' ';
		date_string(days,datebuf+1,format,TRUE);

		// Add string
		strcat(buf,datebuf);
	}
}
void send_headers(int sd, request_t *req) {
	char date_buf[80];
	char buffer[1024];
	if (req->response_code == 200) {
		send_response(sd, "HTTP/1.1 200 OK\n");
	} else if (req->response_code == 400) {
		send_response(sd, "HTTP/1.1 400 Bad Request\n");
	} else if (req->response_code == 404) {
		send_response(sd, "HTTP/1.1 404 Not Found\n");
	} else if (req->response_code == 403) {
		send_response(sd, "HTTP/1.1 403 Forbidden\n");
	} else {
		send_response(sd, "HTTP/1.1 500 Internal Server Error\n");
	}
	date_string(date_buf, sizeof(date_buf));
    snprintf(buffer, sizeof(buffer), "Date: %s\n", date_buf);
	send_response(sd, buffer);
	send_response(sd, "Content-Type: text/html\n");
	snprintf(buffer, sizeof(buffer), "Content-Length: %d\n", req->content_length);
	send_response(sd, buffer);
	send_response(sd, "\n");
}
Exemplo n.º 11
0
/*!
* \brief Creates the GUI for read or delivery reports.
*
* \param titleStrId The form title.
* \param from The from address.
* \param subject The subject.
* \param statusStrId The status of the message.
* \param date The date of the message
* \return TRUE if successful, otherwise FALSE.
*****************************************************************************/
MSF_BOOL meaCreateMvRrDrView(MSF_UINT32 titleStrId, const char *from, const char *subject,
                             MSF_UINT32 statusStrId, MmsTimeSec rDate)
{
    ctk_screen_handle	scrid;
    kal_uint8 			*text;
    int					text_size;
    MYTIME time;
    MSF_UINT16* dateOrTimeString;
    MeaAddrType addrType;
    char *name = NULL;

    if (0 != meaMvRrDrView.formHandle)
    {
        /* Delete the GUI so that all resources are de-allocated */
        meaDeleteMvRrDrView();
    }
    memset(&meaMvRrDrView, 0, sizeof(meaMvRrDrView));

    /* Prepare text */
    text_size = 150; /* The default size. widget_ucs2str_append_* will realloc the buffer on necessary */
    text = MEA_ALLOC(text_size);
    widget_utf8_to_ucs2_string(text, text_size, (kal_uint8*) "");

    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, (MSF_UINT16)titleStrId);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\n\n");

    /* To */
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_TO);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)":\n");

    if (MEA_ADDR_TYPE_PLMN == (addrType = meaGetAddrType(from)))
    {
        name = meaLookupNameFromPHB((char *)from);
        text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)name);
    }
    else
    {
        text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)from);
    }

    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    /* Subject */
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_SUBJECT);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)":\n");
    if (subject)
    {
        text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)subject);
    }
    else
    {
        text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_NO_SUBJECT);
    }
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    /* Date */
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_DATE);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\n");
    dateOrTimeString = MEA_ALLOC(MEA_MAX_DATE_SIZE);
    rDate += (HDIa_timeGetTimeZone() * 60);
    mmi_dt_utc_sec_2_mytime((kal_int32)rDate, &time, KAL_TRUE);
    date_string(&time, dateOrTimeString, DT_IDLE_SCREEN);
    text = widget_ucs2str_append_ucs2(MSF_MODID_MEA, text, &text_size, (kal_uint8 *)dateOrTimeString);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\n");
    time_string(&time, dateOrTimeString, DT_IDLE_SCREEN);
    text = widget_ucs2str_append_ucs2(MSF_MODID_MEA, text, &text_size, (kal_uint8 *)dateOrTimeString);
    MEA_FREE(dateOrTimeString);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\x1B\n");

    /* Status */
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, MEA_STR_ID_STATUS);
    text = widget_ucs2str_append_utf8(MSF_MODID_MEA, text, &text_size, (kal_uint8*)"\n");
    text = widget_ucs2str_append_id(MSF_MODID_MEA, text, &text_size, (MSF_UINT16)statusStrId);

    /* Create widow */
    meaMvRrDrView.formHandle = HDIa_widgetExtCreateTextViewSeparator(MSF_MODID_MEA, text,
                               (MSF_UINT16)titleStrId, 0);

    MEA_FREE(text);
    meaAddWidgetList(meaMvRrDrView.formHandle);

    /* Set Key */
    scrid = HDIa_widgetCtkGetScreenHandle(meaMvRrDrView.formHandle);

#ifdef __UNIFIED_MSG_SUPPORT__
    ctk_screen_addRSK_UA(scrid, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, NULL, meaMvDrViewOk, KAL_TRUE);
    ctk_screen_add_key_UA(scrid, KEY_LEFT_ARROW, NULL, meaMvDrViewOk, KAL_TRUE);
    ctk_screen_addLSK_UA(scrid, MEA_STR_ID_OPTIONS, IMG_GLOBAL_OK, NULL, handleMvPropOptionAction, KAL_TRUE);
#else
    ctk_screen_addLSK_UA(scrid, STR_GLOBAL_OK, IMG_GLOBAL_OK, NULL, meaMvDrViewOk, KAL_TRUE);
    //ctk_screen_add_key_UA(scrid, KEY_LEFT_ARROW, NULL, meaMvPropViewOnlyGoBack, KAL_TRUE);
#endif

    return meaDisplayWindow(meaMvRrDrView.formHandle, meaGetPosLeftTop());
}
Exemplo n.º 12
0
int main()
     
{
  
  struct hostent *hp; /* = gethostbyname(argv[1]);*/
  char record[60];
  modbus_t *mb;

  
  uint16_t tab_secondi[50];
  int nregs_secondi=48; /* 0..47 num. registri da leggere*/
  int addr_secondi=151; /* indirizzo primo registro da leggere */

  uint16_t tab_scatti[50];
  int nregs_scatti=48;
  int addr_scatti=100;

  uint16_t tab_oraplc[10];
  int nregs_oraplc=1;
  int addr_oraplc=150;

  int i;
  
  date_string(dat);
  set_logname();
  
  /*************************************/
  hp=gethostbyname(HOST); /* lo ricalcolo sempre perche' l'ip del GH potrebbe cambiare */
  mb = modbus_new_tcp( (char*)inet_ntoa( *( struct in_addr*)( hp -> h_addr_list[0])), PORT);      

  if ( modbus_connect(mb) == -1) {
    /*Errore di comunicazione*/
    printf("ERRORE1\n");
    date_string(dat); /* imposto il timestamp per il log */
    snprintf(record,(size_t)60,"%s-%s-%s;%s;%s",dat[GIORNO],dat[MESE],dat[ANNO],dat[ORA],"Communication error");
    logvalue(LOG_FILE,record); /* scrivo su file di log l'errore */
    modbus_free(mb); /* ripulisco il context */
    exit(1);
  } else { /* connessione OK, vado a leggere i registri */
    
    /***********************************************/
    /* Reads nregs registers from the address addr */
    /***********************************************/
    if ( (modbus_read_registers(mb, addr_secondi, nregs_secondi, tab_secondi) == -1) ||
	 (modbus_read_registers(mb, addr_scatti,  nregs_scatti,  tab_scatti)  == -1) ||
	 (modbus_read_registers(mb, addr_oraplc,  nregs_oraplc,  tab_oraplc)  == -1) ) {
      /* Errore di lettura */
      printf("ERRORE2\n");
      date_string(dat); /* imposto il timestamp per il log */
      snprintf(record,(size_t)60,"%s-%s-%s;%s;%s",dat[GIORNO],dat[MESE],dat[ANNO],dat[ORA],"Communication error");
      logvalue(LOG_FILE,record); /* scrivo su file di log l'errore */
      modbus_close(mb);
      modbus_free(mb); /* ripulisco il context */
      exit(1);
    } else { /* non ci sono stati errori di comunicazione e di lettura */
      /***********************************************/
      /* stampo i registri letti                     */
      /***********************************************/
      /*ora;secondi_utoclave;secondi_pozzo;scatti_autoclave;scatti_pozzo */
      for (i=0;i<=tab_oraplc[0];i++) {
	printf("%d.30;%d;%d;%d;%d",i,tab_secondi[i],tab_secondi[i+24],tab_scatti[i],tab_scatti[i+24]);
	printf("\n");
      }
#ifdef _DB_

      /* 
	 record ora contiene la data in formato yyyymmdd e anche l'ora nel formato ora:30
      */
      
      strftime(record,sizeof(record),"%Y%m%d",date_string(dat));
      
      /*
	update("secondi", record, tab_oraplc[0], tab_secondi);
	update("scatti",  record, tab_oraplc[0], tab_scatti);
      */
      
      update("ss", record, tab_oraplc[0], tab_secondi, tab_scatti);

#endif        
      modbus_close(mb);
      modbus_free(mb);  
    }
    
  }
  return 0; 
}
Exemplo n.º 13
0
/*****************************************************************************
 * FUNCTION
 *  mmi_rmgr_populate_drm_info_aux
 * DESCRIPTION
 *  
 * PARAMETERS
 *  rights          [?]         
 *  permission      [IN]        
 *  data            [?]         
 * RETURNS
 *  
 *****************************************************************************/
kal_bool mmi_rmgr_populate_drm_info_aux(kal_wchar *path, kal_uint8 app_perm, kal_uint8 *data, kal_int32 ref)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    FS_HANDLE input = FS_ERROR_RESERVED;
    kal_int32 start = 0, end = 0, cons_ret = DRM_RESULT_NON_DRM;
    kal_bool ret = KAL_FALSE, flag = KAL_TRUE;
    kal_uint8 permission;
    drm_method_enum method;
        
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* permission's incorrect, but ok here*/
    if (app_perm == DRM_PERMISSION_ALL)
         permission = DRM_PERMISSION_PLAY;
    else
        permission = app_perm;
    
    if(ref < 0)
    {
        input = DRM_open_file(path, FS_READ_ONLY, permission);

        if (input < FS_NO_ERROR)
            return ret;
        
        method = DRM_get_object_method(input, NULL);    
    }
    else
    {
        method = DRM_get_object_method_by_ref(ref);
    }
    
    if (method != DRM_METHOD_NONE)
    {
        if (ref < 0)
        {
            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_RIGHT));
            mmi_ucs2cat((PS8) data, (PS8) L"\n");
            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_PROTECTED));
            mmi_ucs2cat((PS8) data, (PS8) L"\n");
        }
    }
    else
    {
        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_RIGHT));
        mmi_ucs2cat((PS8) data, (PS8) L"\n");
        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_UNPROTECTED));
        mmi_ucs2cat((PS8) data, (PS8) L"\n");

        if (ref < 0)
        {
            DRM_close_file(input);
        }
        else
        {
            DRM_free_ro_detail();
        }
        return ret;
    }

#ifdef __DRM_V02__
    if (ref < 0)
    {
        kal_wchar *sepa = kal_wstrrchr(path, (kal_int32) '\\');
    
        if (DRM_is_archive(input, NULL) && sepa && kal_wstrncmp(sepa - 4, L".odf\\", 5) != 0)
        {
            /* Multi Part ODF */
            mmi_ucs2cat((PS8) data, (PS8) L" ");
            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_MULTI_PART));
            mmi_ucs2cat((PS8) data, (PS8) L"\n");
            return ret;
        }
    }
#endif    
    
    if (method == DRM_METHOD_FORWARD_LOCK)
    {
        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_SUMMARY));
        mmi_ucs2cat((PS8) data, (PS8) L"\n");
        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_UNLIMITED));
        mmi_ucs2cat((PS8) data, (PS8) L"\n");
        
        if (ref < 0)
        {
            DRM_close_file(input);
        }
        else
        {
            DRM_free_ro_detail();
        }
        return ret;
    }

   
    do
    {
        if (permission & (DRM_PERMISSION_PLAY | DRM_PERMISSION_DISPLAY | DRM_PERMISSION_EXECUTE | DRM_PERMISSION_PRINT | DRM_PERMISSION_EXPORT))
        {
            drm_constraint_struct cons;
            if (ref < 0)
            {
                if (app_perm == DRM_PERMISSION_ALL && permission != DRM_PERMISSION_PLAY)
                {
                    input = DRM_open_file(path, FS_READ_ONLY, permission);

                    if (input < FS_NO_ERROR)
                        return KAL_FALSE;
                }
                
                cons_ret = DRM_get_constraint(input, NULL, permission, &cons);
            }
            else
            {
                cons_ret = DRM_get_constraint_by_ref(ref, permission, &cons);
            }
            
            if (cons_ret >= DRM_RESULT_OK && cons.status == DRM_STATUS_RIGHTS_PRESENT)
            {
                
                if (flag)
                {
                    mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_SUMMARY));
                    mmi_ucs2cat((PS8) data, (PS8) L"\n");
                    flag = KAL_FALSE;
                }

                switch(permission)
                {
                    case DRM_PERMISSION_PLAY:
                        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_DRM_PLAY));
                        mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        break;
                    case DRM_PERMISSION_DISPLAY:
                        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_DRM_DISPLAY));
                        mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        break;
                    case DRM_PERMISSION_EXECUTE:
                        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_DRM_EXECUTE));
                        mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        break;
                    case DRM_PERMISSION_PRINT:
                        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_DRM_PRINT));
                        mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        break;
                    case DRM_PERMISSION_EXPORT:
                        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_DRM_EXPORT));
                        mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        break;
                    default:
                        break;
                }

                if (((method & DRM_METHOD_COMBINED_DELIVERY) ||
                     (method & DRM_METHOD_SEPARATE_DELIVERY) || 
                     (method & DRM_METHOD_V2)) &&
                    (cons.status != DRM_STATUS_NO_RIGHTS))
                {
                
                    MYTIME t;
                    S8 buffer[20];
                    drm_constraint_struct *constraint;
                
                    constraint = &cons;
                    
                    if (constraint->type != DRM_CONSTRAINT_NONE)
                    {
                        if (constraint->type & DRM_CONSTRAINT_COUNT)
                        {
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_COUNT));
                            sprintf((char*)buffer, "\n%d/%d", constraint->used_count, constraint->total_count);
                            mmi_asc_to_ucs2((PS8) & data[mmi_ucs2strlen((PS8) data) << 1], (PS8) buffer);
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        }

                #ifdef __DRM_V02__
                        if (constraint->type & DRM_CONSTRAINT_ACCUMULATED)
                        {
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_ACCUMULATED));
                            sprintf((char*)buffer, "\n%d ", constraint->accum_dur);
                            mmi_asc_to_ucs2((PS8) & data[mmi_ucs2strlen((PS8) data) << 1], (PS8) buffer);
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_SEC));
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        }
                    
                        if (constraint->type & DRM_CONSTRAINT_TIMEDCOUNT)
                        {
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_TIMEDCOUNT));
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                            sprintf((char*)buffer, "%d ", constraint->timed_count);
                            mmi_asc_to_ucs2((PS8) & data[mmi_ucs2strlen((PS8) data) << 1], (PS8) buffer);
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_TIMEDCOUNT_TIME));
                            sprintf((char*)buffer, "%d ", constraint->period);
                            mmi_asc_to_ucs2((PS8) & data[mmi_ucs2strlen((PS8) data) << 1], (PS8) buffer);
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_SEC));
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        }
                #endif /* __DRM_V02__ */

                        if (constraint->type & DRM_CONSTRAINT_DATETIME)
                        {
                            if ((constraint->type & DRM_CONSTRAINT_INTERVAL) && constraint->start_intv != 0)
                            {
                                 /* date time contains interval -> show interval*/
                                 if (constraint->start_time <= constraint->start_intv &&
                                      constraint->end_time >= constraint->end_intv)
                                 {
                                          start = constraint->start_intv;
                                          end = constraint->end_intv;
                                 }
                                 /* interval contains date time -> show date time*/
                                 else if (constraint->start_intv <= constraint->start_time &&
                                      constraint->end_intv >= constraint->end_time)
                                 {
                                          start = constraint->start_time;
                                          end = constraint->end_time;
                                 }
                                 /* date time overlaps interval -> show overlap*/
                                 else if (constraint->start_intv <= constraint->start_time &&
                                      constraint->end_intv <= constraint->end_time && 
                                      constraint->start_time <= constraint->end_intv)
                                 {
                                          start = constraint->start_time;
                                          end = constraint->end_intv;
                                 }
                                 /* interval overlaps date time -> show overlap*/
                                 else if (constraint->start_time <= constraint->start_intv &&
                                      constraint->end_time <= constraint->end_intv &&
                                      constraint->start_intv <= constraint->end_time)
                                 {
                                      start = constraint->start_intv;
                                    end = constraint->end_time;
                                 }
                                 else
                                 {
                                          start = constraint->start_intv;
                                          end = constraint->end_intv;
                                 }
                            }
                            else
                            {
                                start = constraint->start_time;
                                end = constraint->end_time;
                            }
                        }
                        else if (constraint->type & DRM_CONSTRAINT_INTERVAL)
                        {
                            if (constraint->interval <= 0)
                            {
                                start = -1;
                                end = -1;
                            }
                            else
                            {
                                start = constraint->start_intv;
                                end = constraint->end_intv;
                            }
                        }
                        
                        if (start > 0)
                        {
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_START));
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                            mmi_dt_utc_sec_2_mytime(start, &t, FALSE);
                            date_string(&t, (PU16) & data[mmi_ucs2strlen((PS8) data) << 1], DT_IDLE_SCREEN);
                            mmi_ucs2cat((PS8) data, (PS8) L" ");
                            time_string(&t, (PU16) & data[mmi_ucs2strlen((PS8) data) << 1], DT_IDLE_SCREEN);
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                        }
                    
                        if (end > 0)
                        {
                            mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_END));
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");
                            mmi_dt_utc_sec_2_mytime(end, &t, FALSE);
                            date_string(&t, (PU16) & data[mmi_ucs2strlen((PS8) data) << 1], DT_IDLE_SCREEN);
                            mmi_ucs2cat((PS8) data, (PS8) L" ");
                            time_string(&t, (PU16) & data[mmi_ucs2strlen((PS8) data) << 1], DT_IDLE_SCREEN);
                            mmi_ucs2cat((PS8) data, (PS8) L"\n");                    
                        }
                    }
                    else
                    {
                        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_DETAIL_UNLIMITED));
                        mmi_ucs2cat((PS8) data, (PS8) L"\n");
                    }

                }
                
            }

            if (ref < 0)
            {
                DRM_close_file(input);
            }

        }

        permission = permission<<1;
    }
    while(permission < DRM_PERMISSION_ALL && app_perm == DRM_PERMISSION_ALL);
    
    if (flag)
    {
        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_ID_RMGR_SUMMARY));
        mmi_ucs2cat((PS8) data, (PS8) L"\n");
        mmi_ucs2cat((PS8) data, (PS8) GetString(STR_GLOBAL_INVALID));
        mmi_ucs2cat((PS8) data, (PS8) L"\n");
    }

    return ret;
}