Beispiel #1
0
/**
 * Search for a font in the list and load from disk if not present
 */
struct ami_font_node *ami_font_open(const char *font)
{
	struct nsObject *node;
	struct ami_font_node *nodedata;

	node = (struct nsObject *)FindIName((struct List *)ami_font_list, font);
	if(node)
	{
		nodedata = node->objstruct;
		GetSysTime(&nodedata->lastused);
		return nodedata;
	}

	LOG(("Font cache miss: %s", font));

	nodedata = AllocVec(sizeof(struct ami_font_node), MEMF_PRIVATE | MEMF_CLEAR);
	nodedata->font = OpenOutlineFont(font, &ami_diskfontlib_list, OFF_OPEN);

	if(!nodedata->font)
	{
		LOG(("Requested font not found: %s", font));
		warn_user("CompError", font);
		FreeVec(nodedata);
		return NULL;
	}

	nodedata->bold = (char *)GetTagData(OT_BName, 0, nodedata->font->olf_OTagList);
	if(nodedata->bold)
		LOG(("Bold font defined for %s is %s", font, nodedata->bold));
	else
		LOG(("Warning: No designed bold font defined for %s", font));

	nodedata->italic = (char *)GetTagData(OT_IName, 0, nodedata->font->olf_OTagList);
	if(nodedata->italic)
		LOG(("Italic font defined for %s is %s", font, nodedata->italic));
	else
		LOG(("Warning: No designed italic font defined for %s", font));

	nodedata->bolditalic = (char *)GetTagData(OT_BIName, 0, nodedata->font->olf_OTagList);
	if(nodedata->bolditalic)
		LOG(("Bold-italic font defined for %s is %s", font, nodedata->bolditalic));
	else
		LOG(("Warning: No designed bold-italic font defined for %s", font));

	GetSysTime(&nodedata->lastused);

	node = AddObject(ami_font_list, AMINS_FONT);
	if(node)
	{
		node->objstruct = nodedata;
		node->dtz_Node.ln_Name = strdup(font);
	}

	return nodedata;
}
Beispiel #2
0
static BOOL ata_Calibrate(struct IORequest* tmr)
{
    register ULONG x;
    register ULONG scale = 0x8000;	// min iterations...
    volatile register ULONG t = 1;
    struct timeval t1, t2;
    
    D(bug("[ATA  ] Calibration started\n"));

    while (scale <= 0x80000000)
    {
	Forbid();
	GetSysTime(&t1);
	for (x = 1; x < scale; x++)
	    t = (((t + x) * t) - x) / x;    // add, mul, sub, div, trivial benchmark.

	GetSysTime(&t2);
	Permit();
	SubTime(&t2, &t1);
	
	// ok, it's going to be totally insane, if secs > 1.
	if (t2.tv_secs != 0)
	{
	    bug("[ATA  ] micro wait useless.\n");
	    return FALSE;
	}

	/* 
	 * we expect at least 10000 times longer period, which should be 'achievable'
	 * unlikely we will cross the magic boundary here of 4 billion instructions in 10 millisecond (yielding 400'000MIPS?)
	 * on the other side, if we go as low as 1, then 4 iterations of add/sub/mul/div is perfectly fine yielding a bit more than 400ns...
	 */

	if (t2.tv_micro >= 10000)
	    break;
	scale <<= 1;
    }

    D(bug("[ATA  ] Executed %ld ops in %ldus\n", scale, t2.tv_micro));

    // always round up to the next value.. so 30.9 -> 31, 5.1 -> 6, etc 
    x = (x + t2.tv_micro - 1) / t2.tv_micro;
    x = (x+9) / 10;

    bug("[ATA  ] Approximate number of iterations per 100 nanoseconds: %ld\n", x);
    iters_per_100ns = x;
    return TRUE;
}
Beispiel #3
0
String GetTimeZoneText()
{
	Time gmtime = GetUtcTime();
	Time ltime = GetSysTime();
	int d = (int)(ltime - gmtime) / 600;
	return Format("+%02.2d%01.1d0", d / 6, d % 6);
}
Beispiel #4
0
int archdep_rtc_get_centisecond(void)
{
    struct timeval now;

    GetSysTime(&now);
    return now.tv_usec / 10;
}
Beispiel #5
0
void schedule_run(BOOL poll)
{
	struct nscallback *nscb;
	void (*callback)(void *p);
	void *p;
	struct TimeVal tv;

	nscb = pblHeapGetFirst(schedule_list);

	if(nscb == -1) return;

	if(poll)
	{
		/* Ensure the scheduled event time has passed (CmpTime<=0)
		 * For timer signalled events this must *always* be true,
		 * so we save some time by only checking if we're polling.
		 */

		GetSysTime(&tv);
		if(CmpTime(&tv, &nscb->tv) > 0) return;
 	}

	callback = nscb->callback;
	p = nscb->p;
	ami_remove_timer_event(nscb);
	pblHeapRemoveFirst(schedule_list);
	FreeVec(nscb);
	callback(p);
}
Beispiel #6
0
void Ide::SetIdeState(int newstate) {
	if(newstate != idestate)
	{
		if(newstate == BUILDING)
			build_start_time = GetSysTime();
		else
		{
			if(idestate == BUILDING && !IsNull(build_start_time))
				stat_build_time += int(GetSysTime() - build_start_time);
			build_start_time = Null;
		}
	}
	idestate = newstate;
	MakeTitle();
	SetBar();
}
Beispiel #7
0
static void ami_font_cache_cleanup(struct MinList *ami_font_cache_list)
{
	struct nsObject *node;
	struct nsObject *nnode;
	struct ami_font_cache_node *fnode;
	struct TimeVal curtime;

	if(IsMinListEmpty(ami_font_cache_list)) return;

	node = (struct nsObject *)GetHead((struct List *)ami_font_cache_list);

	do
	{
		nnode=(struct nsObject *)GetSucc((struct Node *)node);
		fnode = node->objstruct;
		GetSysTime(&curtime);
		SubTime(&curtime, &fnode->lastused);
		if(curtime.Seconds > 300)
		{
			LOG("Freeing %s not used for %ld seconds", node->dtz_Node.ln_Name, curtime.Seconds);
			DelObject(node);
		}
	} while((node=nnode));

	/* reschedule to run in five minutes */
	ami_schedule(300000, (void *)ami_font_cache_cleanup, ami_font_cache_list);
}
Beispiel #8
0
void CheckDateTime()
{
	Time tm = GetSysTime();
	Date dt = tm;
	
	Value c;
	Value v = tm;
	RDUMP(v);
	ASSERT(v == dt);
	Date xx = v;
	ASSERT(xx == dt);
	c = v;
	RDUMP(c);
	ASSERT(c == dt);
	Value cv = v;
	RDUMP(cv);
	ASSERT(cv == dt);
	
	Value v2 = tm;
	RDUMP(v2);
	ASSERT(v2 == v);
	c = v;
	RDUMP(c);
	ASSERT(c == dt);
	ASSERT(c == tm);
	
	v = dt;
	v2 = ToTime(v);
	
	ASSERT(v == v2);
	ASSERT(GetHashValue(v) == GetHashValue(v2));
}
Beispiel #9
0
void ClipboardLog(const char *txt)
{
	if(!DebugClipboard()) 
		return;
	FileAppend f(GetExeDirFile("clip.log"));
	f << GetSysTime() << ": " << txt << "\n";
}
Beispiel #10
0
//---------------------------------------------------------------------------
void __fastcall TUnitTreatListForm::btnPrintClick(TObject *Sender)
{
	CString szSQL,szFilter0,szFilter1;
	char strCorp[80],strLarge[80],strTemp[80];
	int nSel;
	TListItem *pItem;
	AnsiString szDays;
	BASE2COLDATA rwBase;
	TPrnUnitTreatListForm *pForm;
  TDateTime tNow;

  pForm=new TPrnUnitTreatListForm(Application);
  assert(pForm!=NULL);

	strCorp[0]='\0';
	strLarge[0]='\0';
	if((nSel=lstCorp->ItemIndex)>=0 && nSel<m_lstCorpID.GetSize())
	{
		strcpy(strCorp,m_lstCorpID[nSel]);
	}
	if((nSel=lstLarge->ItemIndex)>=0 && nSel<m_lstLargeID.GetSize())
	{
		strcpy(strLarge,m_lstLargeID[nSel]);
	}
	if(strCorp[0]!='\0' || strLarge[0]!='\0')
	{
		szFilter0.Format(" and mn_code like '%s%s%%'",strCorp,strLarge);
		szFilter1.Format(" and pd_mncode like '%s%s%%'",strCorp,strLarge);
	}

	szSQL="select pd_mncode,count(pd_mncode) as pd_count from BookFactory,PurchaseDetail"
		" where bf_apcode=pd_code";
	szSQL+=szFilter1;
	szSQL+=" group by pd_mncode"
		" order by pd_mncode";
	RunSQL(dm1->Query1,szSQL,true);
	while(!dm1->Query1->Eof)
	{
		strcpy(rwBase.strCode,dm1->Query1->FieldByName("pd_mncode")->AsString.c_str());
		sprintf(rwBase.strName,"%d",dm1->Query1->FieldByName("pd_count")->AsInteger);
		pForm->m_lstBook.Add(rwBase);
		dm1->Query1->Next();
	}

  szSQL="select * from TreatStock,DicUnits,materialno,Manufactur"
		" where ts_ducode=du_code"
		" and ts_mncode=mn_code"
		" and ts_mfcode*=mf_code";
	szSQL+=szFilter0;
	szSQL+=" order by ts_mncode";

  tNow=GetSysTime(false);

	if(!OpenQuery(dm1->sqlPrint,szSQL))	return;

  pForm->txtPrnDate->Caption=(LPCSTR)Time2DBDateString(tNow);
  pForm->PrnView->PreviewModal();
  delete pForm;

}
Beispiel #11
0
//********************************************
// Method      :  AddHisNode
// Description :  向历史记录链表追加节点
// Param       :  输入 BOOK_INFO *pstBookInfo 图书信息指针
//             :  输入 BOOK_OP_EM emOption 操作枚举
// Return      :  BOOL 是否成功
//*******************************************
BOOL AddHisNode(BOOK_INFO *pstBookInfo, BOOK_OP_EM emOption)
{
    BOOK_HIS_NODE *pstTmp = NULL;
    BOOK_HIS_NODE *pstBookHisNode = (BOOK_HIS_NODE *)malloc(sizeof(BOOK_HIS_NODE));

    if ( NULL == pstBookHisNode )
    {
        return FALSE;
    }

    pstBookHisNode->pstNext = NULL;
    pstBookHisNode->stBookHisInfo.emBookOption = emOption;
    pstBookHisNode->stBookHisInfo.pstBookInfo  = pstBookInfo;
    pstBookHisNode->stBookHisInfo.stOptionTime = GetSysTime();

    if ( NULL == g_pstHisLogHead )
    {
        g_pstHisLogHead = pstBookHisNode;
        return TRUE;
    }

    pstTmp = g_pstHisLogHead;
    while( NULL != pstTmp->pstNext )
    {
        pstTmp = pstTmp->pstNext;
    }
    pstTmp->pstNext= pstBookHisNode;

    return TRUE;
}
Beispiel #12
0
int GetTimeZone()
{
	static int zone;
	ONCELOCK {
		for(;;) { // This is somewhat ugly, but unified approach to get time zone offset
			Time t0 = GetSysTime();
			Time gmtime = GetUtcTime();
			Time ltime = GetSysTime();
			if(GetSysTime() - t0 < 1) { // Make sure that there is not much time between calls
				zone = (int)(ltime - gmtime) / 60; // Round to minutes
				break;
			}
		}
	}
	return zone;
}
Beispiel #13
0
void schedule(int t, void (*callback)(void *p), void *p)
{
	struct nscallback *nscb;
	struct TimeVal tv;
	ULONG time_us = 0;

	if(schedule_list == NULL) return;

	nscb = AllocVec(sizeof(struct nscallback), MEMF_PRIVATE | MEMF_CLEAR);
	if(!nscb) return;

	time_us = t*10000; /* t converted to µs */

	nscb->tv.Seconds = time_us / 1000000;
	nscb->tv.Microseconds = time_us % 1000000;

	GetSysTime(&tv);
	AddTime(&nscb->tv,&tv); // now contains time when event occurs

	if(nscb->treq = AllocVec(sizeof(struct TimeRequest),MEMF_PRIVATE | MEMF_CLEAR))
	{
		*nscb->treq = *tioreq;
    	nscb->treq->Request.io_Command=TR_ADDREQUEST;
    	nscb->treq->Time.Seconds=nscb->tv.Seconds; // secs
    	nscb->treq->Time.Microseconds=nscb->tv.Microseconds; // micro
    	SendIO((struct IORequest *)nscb->treq);
	}

	nscb->callback = callback;
	nscb->p = p;

	pblHeapInsert(schedule_list, nscb);
}
Beispiel #14
0
static int UUID_Init(LIBBASETYPEPTR LIBBASE)
{
    struct timeval tv;
    uuid_time_t time_now;
    
    /* Set up global lock (class and interface locks are separate!) */
    InitSemaphore(&LIBBASE->uuid_GlobalLock);
    
    D(bug("[UUID] UUID Init\n"));
    
    LIBBASE->uuid_Initialized = 0;
    
    /* I need timer.device in order to obtain system time */
    if (OpenDevice("timer.device", UNIT_MICROHZ, &LIBBASE->uuid_TR, 0))
    {
        D(bug("[UUID] Could not open timer.device. ABORT!\n"));
        return FALSE;
    }
    
    /* get the system time and convert it to UUID time */
    GetSysTime(&tv);
    time_now = LIBBASE->uuid_NextUpdate = LIBBASE->uuid_LastTime = 
        ((uint64_t)tv.tv_secs + 2922) * 10000000 +
        ((uint64_t)tv.tv_micro) * 10 +
        ((uint64_t)0x01B21DD213814000LL);
    
    D(bug("[UUID] UUID time: 0x%08lx%08lx\n", 
          (uint32_t)((LIBBASE->uuid_LastTime >> 32) & 0xffffffff),
          (uint32_t)((LIBBASE->uuid_LastTime & 0xffffffff))
          ));
    
    /* Seed the random generator */
    time_now /= UUIDS_PER_TICK;
    UUIDBase->uuid_RandomSeed = (time_now >> 32) ^ time_now; 
    UUIDBase->uuid_UUIDs_ThisTick = 0;
    
    /* Try to open dos.library for GetVar/SetVar */
    DOSBase = OpenLibrary("dos.library", 0);
    if (DOSBase)
    {
        D(bug("[UUID] dos.library opened. Trying to get the UUID state.\n"));
        
        /* DOS is there. Try to get the last UUID state. */
        if (GetVar("uuid_state", (UBYTE*)&LIBBASE->uuid_State, sizeof(uuid_state_t),
               GVF_BINARY_VAR | GVF_DONT_NULL_TERM) == sizeof(uuid_state_t))
        {
            D(bug("[UUID] got last UUID state\n"));
            LIBBASE->uuid_Initialized = 1;
        }
        else
        {
            D(bug("[UUID] no UUID state found. Staying uninitlaized\n"));
        }
    }
    else
        D(bug("[UUID] dos.library not yet available. I will try later."));
    
    return TRUE;
}
Beispiel #15
0
void sTime(char *h, const char *ext)
{
	Time t = GetSysTime();
	char th[200];
	sprintf(th, ".%d-%02d-%02d-%02d-%02d-%02d", t.year, t.month, t.day, t.hour, t.minute, t.second);
	strcat(th, ext);
	sLogFile(h, th);
}
Beispiel #16
0
void IdePngDes::Create(const char *_filename)
{
	Clear();
	filename = _filename;
	filetime = GetSysTime();
	Image m = CreateImage(Size(16, 16), Null);
	AddImage(filename, m, false);
	SingleMode();
}
Beispiel #17
0
	virtual Vector<FileInfo> GetFileInfo(const Vector<String>& path) {
		Vector<FileInfo> fi = host->GetFileInfo(path);
		for(int i = 0; i < path.GetCount(); i++)
			if(path[i] == onefile)
				(Time &)fi[i] = GetSysTime();
			else
				(Time &)fi[i] = Time::Low();
		return fi;
	}
Beispiel #18
0
void InitPrefs(BOOL use, BOOL save)
{
    struct timeval tv;
    
    GetSysTime(&tv);
    Amiga2Date(tv.tv_secs, &clockdata);
    
    if (use || save) Cleanup(NULL);
}
Beispiel #19
0
int dbDatabase::PutRecord(unsigned int tbHandle, int recno, dbRecord& Record, bool f) {
  unsigned int j, i, r;
  int z;
  char buff[2];

	ArrayMap<String, struct fieldStruct> &fs = fields[tbHandle];
  if( (recno > 0) && (recno <= tables[tbHandle].numOfRecord)) {
    if(IsDeleted(tbHandle, recno)) return MTDB_REC_DELETED;
    tables[tbHandle].record = recno;
  }
  else if((recno == MTDB_TB_APP) || (recno == tables[tbHandle].numOfRecord+1)) {
    tables[tbHandle].numOfRecord++;
    tables[tbHandle].record = tables[tbHandle].numOfRecord;
    recno = tables[tbHandle].record;
    Insert(tables[tbHandle].offset + tables[tbHandle].tableHead + ((recno-1) * tables[tbHandle].recordLenght), tables[tbHandle].recordLenght);
    eodsp += tables[tbHandle].recordLenght;
    for(r=tbHandle+1; r<numOfTables; r++) {
      tables[r].offset += tables[tbHandle].recordLenght;
    }
    dbUpdateHead();
    buff[0] = MTDB_TB_RECORD_ENABLED;
    lseek(fhandle, (int)tables[tbHandle].offset+tables[tbHandle].tableHead+(tables[tbHandle].recordLenght*(recno-1)), 0);
    write(fhandle, buff, 1);
    // verifico ed aggiorno la chiave primaria
    for(i=0; i<tables[tbHandle].numOfFields; i++) {
    	if (_isBitSet(fs[i].flags, MTDB_FD_PRIM_KEY)) {
				lseek(fhandle, (int)tables[tbHandle].offset+tables[tbHandle].tableHead+(tables[tbHandle].recordLenght*(recno-1))+fs[i].prevLength+1, 0);
				write(fhandle, &tables[tbHandle].autoincCntr, fs[i].length);
        tables[tbHandle].autoincCntr++;
  		}
    }
		// fine agg. chiave primaria
		tbUpdateHead(tbHandle);
  }
  else if(recno == MTDB_TB_ACT)
    recno = tables[tbHandle].record;
  else
    return MTDB_INV_RECNO;
  
#ifdef _WITH_DEBUG
RLOG("Put record: " + FormatInt(recno));
#endif

	for(j=0; j<Record.GetCount(); j++) {
		ArrayMap<String, struct fieldStruct> &fs = fields[tbHandle];
		z = fs.Find(Record.GetName(j));
		if(z >= 0) FieldPut(tbHandle, recno, z, Record[j], f);
	}

	Time t = GetSysTime();	
	lseek(fhandle, (int)tables[tbHandle].offset+21, 0);
	write(fhandle, &t, 8);
	tables[tbHandle].lastModifyTime = t;
	
	return MTDB_SUCCESS;
}
Beispiel #20
0
bool TAPAffirmAndNotBookForm::GetFilter(CString &szFilter)
{
	char strTemp[256],strDate0[80];
	int nSel;
  
	edtID->Text=edtID->Text.Trim();
	if(!edtID->Text.IsEmpty())
	{
		sprintf(strTemp," and pd_code like '%s%%'",edtID->Text.c_str());
		szFilter+=strTemp;
	}
	if(lstType->ItemIndex>0)
	{
		sprintf(strTemp," and ap_type='%s'",lstType->Text=="普通" ? "N" : "I");
		szFilter+=strTemp;
	}
	if((nSel=lstStockDep->ItemIndex)>=0 && nSel<m_lstStockDepID.GetSize())
//	if((nSel=lstStockDep->ItemIndex)>0 && nSel<m_lstStockDepID.GetSize())
	{
		sprintf(strTemp," and ap_sdcode='%s'",m_lstStockDepID[nSel]);
		szFilter+=strTemp;
	}
	if((nSel=lstAskDep->ItemIndex)>0 && nSel<m_lstReqDepID.GetSize())
	{
		sprintf(strTemp," and ap_reqdepart='%s'",m_lstReqDepID[nSel]);
		szFilter+=strTemp;
	}
	edtMncode->Text=edtMncode->Text.Trim();
	if(!edtMncode->Text.IsEmpty())
	{
		sprintf(strTemp," and pd_mncode like '%s%%'",edtMncode->Text.c_str());
		szFilter+=strTemp;
	}
	if((nSel=lstStockman->ItemIndex)>0 && nSel<m_lstStockmanID.GetSize())
	{
		sprintf(strTemp," and ap_shcode='%s'",m_lstStockmanID[nSel]);
		szFilter+=strTemp;
	}
	if((nSel=lstReqCorp->ItemIndex)>0 && nSel<m_lstCorpID.GetSize())
	{
		sprintf(strTemp," and substring(ap_reqdepart,1,2)='%s'",m_lstCorpID[nSel]);
		szFilter+=strTemp;
	}
	if(!edtAfmDay->Text.IsEmpty())
	{
		TDateTime tNow=GetSysTime(false);
		unsigned short year,month,day;

		tNow-=atoi(edtAfmDay->Text.c_str());
		tNow.DecodeDate(&year,&month,&day);
		sprintf(strTemp," and ap_affirmdate<'%04d-%02d-%02d'",year,month,day);
		szFilter+=strTemp;
	}

	return true;
}
Beispiel #21
0
void Log::print(string message){
    if(message.empty() == true) return;
    string gtime;
    if(plaintext == true){
        gtime = GameTime() + GetSysTime() +FrameTime() + message + "\n";
    }else{
        gtime = "\n<tr><th width='8%' scope='row'><b>" + GameTime() + FrameTime() +"</b></th>\n<td width='92%'>" + message + "</td></tr>\n";
    }
    header(gtime);
}
Beispiel #22
0
void	HoldCOM0ConnSta(void)
{
	if((GetSysTime()-l_COM0ConnTime > 2 && l_COM0StartFlg == 1 )
		||(l_COM0TimeOutFlg == 1))
	{
		l_COM0EndFlg = 1;
		l_COM0StartFlg = 0;
		l_COM0TimeOutFlg = 0;
	}
}
Beispiel #23
0
	void Log::print(std::string message){
		if(message.empty() == true) return;
		if (!G) {
			//NLOG(message);
			return;
		}
		std::string gtime;
		gtime = GameTime() + GetSysTime() +FrameTime() + message + "\n";
		header(gtime);
	}
Beispiel #24
0
void WorkspaceWork::LoadActualPackage()
{
	Time utime = FileGetTime(ConfigFile("version"));
	filelist.Clear();
	fileindex.Clear();
	bool open = true;
	Time tm = GetSysTime();
	for(int i = 0; i < actual.file.GetCount(); i++) {
		Package::File& f = actual.file[i];
		if(f.separator) {
			open = closed.Find(Sepfo(actualpackage, f)) < 0;
			filelist.Add(f, open ? IdeImg::SeparatorClose() : IdeImg::SeparatorOpen(),
			             ListFont().Bold(), open ? SColorMark : SColorText, true, 0, Null);
			fileindex.Add(i);
		}
		else
		if(open) {
			Color uln = Null;
			String p = SourcePath(GetActivePackage(), f);
			if(showtime) {
				FindFile ff(p);
				if(ff) {
					Time ftm = Time(ff.GetLastWriteTime());
					if(ftm > utime) {
						int64 t = tm - ftm;
						if(t < 24 * 3600)
							uln = SColorMark;
						else
						if(t < 32 * 24 * 3600)
							uln = SColorDisabled;
					}
				}
			}
			Image m = IdeFileImage(f, f.optimize_speed, false, f.pch);
			if(GetFileExt(p) == ".tpp" && IsFolder(p)) {
				if(FileExists(AppendFileName(p, "all.i")))
					m = TopicImg::IGroup();
				else
					m = TopicImg::Group();
			}
		#ifdef PLATFORM_WIN32
			p = ToLower(p);
		#endif
			if(errorfiles.Find(p) >= 0) {
				m = ImageOverRed(m);
				uln = LtRed;
			}
			filelist.Add(f, m, ListFont(), SColorText, false, 0,
			             Null, SColorMark, Null, Null, Null, uln);
			fileindex.Add(i);
		}
	}
}
Beispiel #25
0
void __fastcall TBookNotAcceptListForm::btnprintClick(TObject *Sender)
{
  CString szSQL,szTable;
  int i;
  TListItem *pItem;
  TPrnBookNotAcceptForm *pPrn;
  TDateTime tNow;

  szTable=GetTmpTableName();
  szSQL.Format("create table dbo.%s ("
               "m_bookid varchar(20),"
               "m_date varchar(20),"
               "m_days varchar(4),"
               "m_mncode varchar(25),"
               "m_mnname varchar(80),"
               "m_corp varchar(20),"
               "m_sdname varchar(20)"
               ")",szTable);

  if(!RunSQL(dm1->Query1,szSQL))  return;
  //if(lstView->Items->Count>0)
    //lstView->SelectAll();

  for(i=0;i<lstView->Items->Count;i++)
   {
    pItem=lstView->Items->Item[i];
    szSQL.Format("insert into %s values(",szTable);
    szSQL+=Str2DBString(pItem->Caption.c_str());
    szSQL+=",";    szSQL+=Str2DBString(pItem->SubItems->Strings[0].c_str());
    szSQL+=",";    szSQL+=Str2DBString(pItem->SubItems->Strings[1].c_str());
    szSQL+=",";    szSQL+=Str2DBString(pItem->SubItems->Strings[2].c_str());
    szSQL+=",";    szSQL+=Str2DBString(pItem->SubItems->Strings[3].c_str());
    szSQL+=",";    szSQL+=Str2DBString(pItem->SubItems->Strings[4].c_str());
    szSQL+=",";    szSQL+=Str2DBString(pItem->SubItems->Strings[6].c_str());
    szSQL+=")";
    if(!RunSQL(dm1->Query1,szSQL))  goto DROP_TABLE;
   }

  pPrn=new TPrnBookNotAcceptForm(this);
  assert(pPrn!=NULL);
  tNow=GetSysTime(false);
  pPrn->txtPrnTime->Caption=(LPCSTR)Time2DBTimeString(tNow);
  szSQL.Format("select * from %s order by m_bookid",szTable);

  if(RunSQL(dm1->sqlPrint,szSQL,true))
   {pPrn->PrnView->PreviewModal();}
  delete pPrn;

  DROP_TABLE:
    szSQL.Format("drop table dbo.%s",szTable);
    RunSQL(dm1->Query1,szSQL);
}
Beispiel #26
0
int MSDKVpp::PrepareVppCompFrames()
{
    std::map<MSDKDecodeVpp*, MediaBuf>::iterator it;
    MSDKDecode* pDecode = NULL;

    if (0 == m_tCompStc) {
        //Init stage. Synchronous reference time sequence
        //Wait for all the frame to generate the 1st composited one.
        for (it = m_mapMediaBuf.begin(); it != m_mapMediaBuf.end(); ++it)
        {
            pDecode = dynamic_cast<MSDKDecode*>(it->first);
            while (!pDecode->FullStage())
            {
                //pDecode->RING_BUFFER is not in full stage, just sleep and wait
                if (m_bWantToStop)
                    return -1;
                usleep(1000);
            }
        }
        m_rCallback.StartTrain();
    } else {
        usleep(m_nSleepInterval);
        unsigned int nEosCnt = 0;
        for (it = m_mapMediaBuf.begin(); it != m_mapMediaBuf.end(); ++it)
        {
            pDecode = dynamic_cast<MSDKDecode*>(it->first);
            if (pDecode->GetDataEos() && it->second.pRingBuf->IsEmpty())
            {
                nEosCnt++;
                if (m_mapMediaBuf.size() == nEosCnt)
                {
                    VPP_TRACE_INFO("[MSDKVpp]-----All video stream EOS, can end VPP now: %d\n",nEosCnt);
                    return 1;
                }
                pDecode->RequestLastSurface();
                continue;
            }
            //Frames comes late.
            //Use last surface, maybe need to drop 1 frame in future.
            if (it->second.pRingBuf->IsEmpty())
            {
                pDecode->RequestLastSurface();
                //it->second.nDropFrameNums++;
            }
        }
    }
    m_tCompStc = GetSysTime();
    return 0;
}
Beispiel #27
0
struct ami_font_cache_node *ami_font_cache_alloc_entry(const char *font)
{
	struct ami_font_cache_node *nodedata;

#ifdef __amigaos4__
	uint32 hash = XXH32(font, strlen(font), 0);
	nodedata = (struct ami_font_cache_node *)InsertSkipNode(ami_font_cache_list, (APTR)hash, sizeof(struct ami_font_cache_node));
#else
	nodedata = AllocVecTagList(sizeof(struct ami_font_cache_node), NULL);
#endif

	GetSysTime(&nodedata->lastused);

	return nodedata;
}
Beispiel #28
0
TDumpJobInfo::TDumpJobInfo(const TBsInfo &absi, bool abMaster)
    : bsi(absi),
      bMaster(abMaster),
      nCurAddr(0x100),
      nMaxAddr(c_nBsMemSize),
      Status(sOk),
      JobState(jsStart),
      MainState(msReading),
      m_TimeEstimator(GetSysTime(),
                      milliseconds(5000),
                      milliseconds(30000),
                      milliseconds(300),
                      milliseconds(1*60*60*1000))
{
}
Beispiel #29
0
void Ide::Times()
{
	WithStatisticsLayout<TopWindow> statdlg;
	CtrlLayout(statdlg, "Elapsed times");
	statdlg.SetTimeCallback(-1000, statdlg.Breaker(IDRETRY), 50);
	do
	{
		int session_time = int(GetSysTime() - start_time);
		int idle_time = int(session_time - editor.GetStatEditTime() - stat_build_time);
		statdlg.session_time <<= FormatElapsedTime(session_time);
		statdlg.edit_time    <<= FormatElapsedTime(editor.GetStatEditTime());
		statdlg.build_time   <<= FormatElapsedTime(stat_build_time);
		statdlg.idle_time    <<= FormatElapsedTime(idle_time);
	}
	while(statdlg.Run() == IDRETRY);
}
Beispiel #30
0
int gettimeofday(struct timeval *tp, struct timezone *tzp)
{
	if (tp)
	{
		GetSysTime(tp);
#if 0
	void GetSysTime( struct timeval * );
		TimerIO->tr_node.io_Command = TR_GETSYSTIME;
		DoIO((struct IORequest *) TimerIO);
		*tp = TimerIO->tr_time;
#endif

		/* add the offset from unix to amigados time system (NEEDED???) */
		tp->tv_sec += (8*365+2) * 24 * 3600;
	}

  return 0;
}