这篇教程C++ CurrentTime函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CurrentTime函数的典型用法代码示例。如果您正苦于以下问题:C++ CurrentTime函数的具体用法?C++ CurrentTime怎么用?C++ CurrentTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CurrentTime函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ImgLoad// Image load callback - inserts the probes.void ImgLoad(IMG img, void *v){ // Called every time a new image is loaded if ( (IMG_Name(img).find("libncurses.so") != string::npos) || (IMG_Name(img).find("LIBNCURSES.SO") != string::npos) || (IMG_Name(img).find("LIBNCURSES.so") != string::npos) ) { RTN rtngetch = RTN_FindByName(img, "getch"); if (RTN_Valid(rtngetch) && RTN_IsSafeForProbedReplacement(rtngetch)) { OutFile << CurrentTime() << "Inserting probe for getch at " << RTN_Address(rtngetch) << endl; OutFile.flush(); AFUNPTR fptr = (RTN_ReplaceProbed(rtngetch, AFUNPTR(mygetch))); fptrgetch = (int (*)())fptr; } RTN rtnmvgetch = RTN_FindByName(img, "mvgetch"); if (RTN_Valid(rtnmvgetch) && RTN_IsSafeForProbedReplacement(rtnmvgetch)) { OutFile << CurrentTime() << "Inserting probe for mvgetch at " << RTN_Address(rtnmvgetch) << endl; OutFile.flush(); AFUNPTR fptr = (RTN_ReplaceProbed(rtnmvgetch, AFUNPTR(mymvgetch))); fptrmvgetch = (int (*)(int, int))fptr; } } // finished instrumentation}
开发者ID:EmilyBragg,项目名称:profiling-tool,代码行数:29,
示例2: mainint main(int argc, char const *argv[]){ char texto[200],nombre[200]; double start, end,seconds; start=CurrentTime(); char *t1,*t2,*t3; char *resp; int i; system("clear"); FILE *archivo1=NULL,*archivo2=NULL; resp=strstr( argv[2], ".txt" ); if(resp==NULL){ error(3); } if(argc==3&&strcmp(argv[1],"-FILE")==0){ if((archivo1=fopen(argv[2],"r"))==NULL){ error(1); } do{ fscanf(archivo1,"%[^/n/r]/n|/r",texto); t1=strtok(texto,"/t"); t2=strtok(NULL,"/t"); sprintf(nombre, "./MainHaus -FILES %s %s",t1,t2); printf("%s-%s/n", t1,t2); for (i = 0; i < 31; ++i) { system(nombre); anilizaerror(); } t3=strtok(t1,"."); sprintf(nombre, "%s",t3); t3 = strtok(t2,"."); sprintf(nombre, "%s_%s.out",nombre,t3); if((archivo2=fopen(nombre,"r"))==NULL){ error(1); } for (i = 0; i <31; ++i) { fscanf(archivo2,"%[^/n]/n",texto); vector[i]=atof(strtok(texto,"/t")); } calculo(); guardar_archivo(); printf("/n"); }while(!feof(archivo1)); fclose(archivo1); }else{error(2);} end=CurrentTime(); seconds=(end-start); printf("Segundos: %.5f/tReloj de computadora:%.10f/n",seconds,seconds/(double)CLOCKS_PER_SEC); return 0;}
开发者ID:sdx360,项目名称:Poo_C,代码行数:59,
示例3: TEST_F TEST_F(TestDownloader, WaitShouldWait) { const std::string data(CHUNK_SIZE, '$'); FakeSource src(data, CHUNK_DELAY, CHUNK_NUMBER); Queue q; Downloader dl(src, q); ptime t1(CurrentTime()); dl.Start(); dl.Wait(); ptime t2(CurrentTime()); ASSERT_GE(t2, t1 + millisec(CHUNK_DELAY * CHUNK_NUMBER) ); }
开发者ID:rushad,项目名称:filetransfer,代码行数:15,
示例4: EnterInJournal/*** A "local" function of KeepState(). Enters #name# marked with #seqNo# into** the state file (global) #journalPath#. Used to keep a log of all writes** performed by the memory. Returns 1 if successful, else 0.*/static intEnterInJournal(const char *name, double seqNo) { char journalRec[MAX_RECORD_SIZE]; double now; memset(journalRec, 0, sizeof(journalRec)); now = CurrentTime(); if(sprintf(journalRec,"%10.0f %64s", seqNo, name) < 2) { FAIL1("EnterInJournal: write failed, errno %d/n", errno); } if(!WriteState(journalPath, journalFileSize, KEEP_A_LONG_TIME, now, journalRec, strlen(journalRec))) { FAIL("EnterInJournal: write state failed/n"); } return(1);}
开发者ID:LogisticalComputingAndInternetworking,项目名称:LoRS,代码行数:31,
示例5: DoSearch/*** A "local" function of ProcessRequest(). Searches through the registration** file for unexpired objects that match #filter#. Returns a malloc'ed string** of the matching objects.*/static char *DoSearch(const char *filter) { unsigned long expiration; char expirationImage[15 + 1]; unsigned long now; const char *object; const char *registration; char *returnValue; now = (unsigned long)CurrentTime(); returnValue = strdup(""); for(rewind(registrationFile); (registration = ReadRegistration()) != NULL;) { (void)GETWORD(expirationImage, registration, &object); expiration = atol(expirationImage); if((expiration == ETERNAL) || (expiration > now)) { object++; /* Skip space after expiration. */ if(MatchFilter(object, filter)) { returnValue = REALLOC(returnValue, strlen(returnValue) + strlen(object) + 1); strcat(returnValue, object); } } } return returnValue;}
开发者ID:LogisticalComputingAndInternetworking,项目名称:LoRS,代码行数:34,
示例6: DoClean/*** A "local" function of ProcessRequest(). Implements the MEMORY_CLEAN service** by deleting all files in the memory directory that have not been accessed** within the past #idle# seconds. Returns 1 if successful, else 0.*/static intDoClean(unsigned long idle) { struct dirent *entry; DIR *directory; time_t expiration; char filePath[255 + 1]; struct stat fileStat; char *namePlace; directory = opendir(memoryDir); if(directory == NULL) { FAIL1("DoClean: unable to open directory %s/n", memoryDir); } expiration = (time_t)CurrentTime() - (time_t)idle; SAFESTRCPY(filePath, memoryDir); namePlace = filePath + strlen(filePath); while((entry = readdir(directory)) != NULL) { strcpy(namePlace, entry->d_name); if(stat(filePath, &fileStat) != 0) { WARN1("DoClean: unable to state file %s/n", filePath); } else if(fileStat.st_mtime < expiration) { LOG2("DoClean: deleting %s, last modified %d/n", filePath, fileStat.st_mtime); (void)unlink(filePath); } } (void)closedir(directory); return(1);}
开发者ID:LogisticalComputingAndInternetworking,项目名称:LoRS,代码行数:40,
示例7: CompressRegistrations/*** A "local" function of main(). Deletes from the registration file all** objects that have an expiration time which has already passed.*/static voidCompressRegistrations(void) { size_t bytesCompressed = 0; unsigned long expiration; char expirationImage[15 + 1]; const char *ignored; unsigned long now; size_t recordLen; const char *registration; now = (unsigned long)CurrentTime(); for(rewind(registrationFile); (registration = ReadRegistration()) != NULL;) { (void)GETWORD(expirationImage, registration, &ignored); expiration = atol(expirationImage); recordLen = strlen(registration) + 1; if((expiration != ETERNAL) && (expiration <= now)) { bytesCompressed += recordLen; } else if(bytesCompressed > 0) { /* Move this record forward to the end of the still-current objects. */ fseek(registrationFile, -(recordLen + bytesCompressed), SEEK_CUR); fprintf(registrationFile, "%s/n", registration); fseek(registrationFile, bytesCompressed, SEEK_CUR); } } /* Truncate any records that we've moved. */ if(bytesCompressed > 0) { fseek(registrationFile, -bytesCompressed, SEEK_CUR); ftruncate(fileno(registrationFile), ftell(registrationFile)); }}
开发者ID:LogisticalComputingAndInternetworking,项目名称:LoRS,代码行数:39,
示例8: memset//Construct Response Header char *constructHeader(char* FilePath){ FILE *fp; fp=fopen(FilePath+1,"r"); if(fp==NULL) return NULL; else { char *header =malloc(sizeof(char)*BUF_SIZE); memset(header,0,sizeof(char)*BUF_SIZE); strcpy(header,"HTTP/1.1 200 OK/nConnection: close/nDate: "); char *time = CurrentTime(); strcat(header,time); strcat(header,"Last-Modified: "); char *modtime = LastModified(FilePath); strcat(header,modtime); strcat(header,"Content-Length: "); int leng = Length(FilePath); char len[32]; sprintf(len,"%d",leng); strcat(header,len); strcat(header,"/nContent-Type: "); char *type = FileType(FilePath); strcat(header,type); strcat(header,"/r/n/r/n"); return header; free(header); } fclose(fp); }
开发者ID:Haosheng,项目名称:Concurrent-Web-Server-using-BSD-sockets,代码行数:31,
示例9: ResetTimer//This function reset timer according to first PCB in timer queueint ResetTimer(){ MEMORY_MAPPED_IO mmio; //for hardware interface int SleepTime; //when timer queue is not empty if (timerQueue->Element_Number > 0){ //calculate sleep time SleepTime = timerQueue->First_Element->PCB->WakeUpTime - CurrentTime(); //set timer only if it's positive if (SleepTime > 0){ mmio.Mode = Z502Start; mmio.Field1 = SleepTime; // You pick the time units mmio.Field2 = mmio.Field3 = 0; MEM_WRITE(Z502Timer, &mmio); //if success, return 1 return 1; } else{ //if sleep time is negative, return 0 return 0; } } else{ //if timer queue empty, return -1 return -1; }}
开发者ID:tyang1991,项目名称:Operating-System,代码行数:28,
示例10: peer_id PeerInterface::PeerInterface(const PeerID & peer_id, Uint32 num_chunks) : peer_id(peer_id),pieces(num_chunks) { stats.interested = false; stats.am_interested = false; stats.choked = true; stats.interested = false; stats.am_interested = false; stats.download_rate = 0; stats.upload_rate = 0; stats.perc_of_file = 0; stats.snubbed = false; stats.dht_support = false; stats.fast_extensions = false; stats.extension_protocol = false; stats.bytes_downloaded = stats.bytes_uploaded = 0; stats.aca_score = 0.0; stats.has_upload_slot = false; stats.num_up_requests = stats.num_down_requests = 0; stats.encrypted = false; stats.local = false; stats.max_request_queue = 0; stats.time_choked = CurrentTime(); stats.time_unchoked = 0; stats.partial_seed = false; killed = false; paused = false; }
开发者ID:KDE,项目名称:libktorrent,代码行数:27,
示例11: CurrentTime// returns false if there were no timersbool TIMEOUT::CheckTimers(LARGE_INTEGER& ret){ LARGE_INTEGER now = CurrentTime(); TIMEOUT *t; if (!g_Timeouts.Head()) return false; ret.QuadPart = 0LL; while (1) { t = g_Timeouts.Head(); if (!t) return true; if (t->Expires.QuadPart > now.QuadPart) break; t->DoTimeout(); } // calculate the timeout ret.QuadPart = t->Expires.QuadPart - now.QuadPart; return true;}
开发者ID:bragin,项目名称:ring3k,代码行数:27,
示例12: ReadBlocksstatus_tTAPEReader::GetNextChunk(void* oCookie, const void** oChunkBuffer, size_t* oChunkSize, media_header* oMediaHeader){ int64 aOutSize; // check whether song is finished or not if (mReadPosTotal - mReadPos + mPlayPos >= mDataSize) return B_ERROR; // reading data if (mPlayPos >= mReadPos ) ReadBlocks(); // passing data if (mReadPos-mPlayPos >= BUFFER_SIZE) aOutSize = BUFFER_SIZE; else aOutSize = mReadPos-mPlayPos; *oChunkBuffer = &mDecodedData[mPlayPos]; mPlayPos += aOutSize; // passing info *oChunkSize = aOutSize; oMediaHeader->start_time = CurrentTime(); oMediaHeader->file_pos = mPlayPos; return B_OK;}
开发者ID:looncraz,项目名称:haiku,代码行数:29,
示例13: CurrentTimevoid Logger::fillFileBuffer(std::string &outputBuffer, const std::string &tag, const std::string &msg, const char *funcName, const char *sourceFile, unsigned int lineNum){ // Old format if (!isHTML) { if (!tag.empty()) outputBuffer = "[" + tag + "] "; else outputBuffer = "[NOTAG] "; if (sourceFile != NULL) { outputBuffer += sourceFile; outputBuffer += " "; } if (funcName != NULL && lineNum != 0) { outputBuffer += funcName; outputBuffer += ":"; // Convert int to char outputBuffer += std::to_string(lineNum); } outputBuffer += ": "; outputBuffer += msg; outputBuffer += "/n"; } else { outputBuffer = "<tr>"; if (!tag.empty()) outputBuffer += "<td>" + tag + "</td>"; else outputBuffer = "<td>NOTAG</td>"; outputBuffer += "<td>" + CurrentTime() + "</td>"; if (sourceFile != NULL) { outputBuffer += "<td>"; outputBuffer += sourceFile; outputBuffer += "</td>"; } if (funcName != NULL && lineNum != 0) { outputBuffer += "<td>"; outputBuffer += funcName; outputBuffer += ":"; // Convert int to char outputBuffer += std::to_string(lineNum); outputBuffer += "</td>"; } outputBuffer += "<td>"; outputBuffer += msg; outputBuffer += "</td></tr>"; }}
开发者ID:0ldm0s,项目名称:IntWars,代码行数:59,
示例14: CurrentTime//-------------------------------------------------------------------// TempFileName::GenerateRandomName//-------------------------------------------------------------------String TempFileName::GenerateRandomName(){ if( !s_lLastNumber ) // Initialize random sequence s_lLastNumber = CurrentTime().long_unix(); return String::str_format("temp%lx", s_lLastNumber++);}
开发者ID:MaxIV-KitsControls,项目名称:EPU61,代码行数:11,
示例15: myCryptHashDataBOOL WINAPI myCryptHashData(HCRYPTHASH hHash, BYTE *pbData, DWORD dwDataLen, DWORD dwFlags) { FILE *fd = fopen("C://CryptoBlock32.txt", "a"); std::string mytime = CurrentTime(); fprintf(fd, "%s myCryptHashData(%x,%p,%x,%x)/n", mytime.c_str(), hHash, pbData, dwDataLen, dwFlags); fclose(fd); return Real_CryptHashData(hHash, pbData, dwDataLen, dwFlags);}
开发者ID:raghavendravp,项目名称:Charlie-2,代码行数:8,
示例16: myCryptCreateHashBOOL WINAPI myCryptCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, HCRYPTHASH *phHash) { FILE *fd = fopen("C://CryptoBlock32.txt", "a"); std::string mytime = CurrentTime(); fprintf(fd, "%s myCryptCreateHash(%x,%x,%x,%x,%p)/n", mytime.c_str(), hProv, Algid, hKey, dwFlags, phHash); fclose(fd); return Real_CryptCreateHash(hProv, Algid, hKey,dwFlags, phHash);}
开发者ID:raghavendravp,项目名称:Charlie-2,代码行数:8,
示例17: mymq_closeint mymq_close(mqd_t __mqdes){ OutFile << CurrentTime() << "mymq_close called " << endl; OutFile.flush(); int res = fptrmq_close(__mqdes); return res;}
开发者ID:asudhak,项目名称:peachfuzz-code,代码行数:8,
示例18: mymq_sendint mymq_send(mqd_t __mqdes, const CHAR_PTR __msg_ptr, size_t __msg_len, unsigned __msg_prio){ OutFile << CurrentTime() << "mymq_send called " << endl; OutFile.flush(); int res = fptrmq_send(__mqdes, __msg_ptr, __msg_len, __msg_prio); return res;}
开发者ID:asudhak,项目名称:peachfuzz-code,代码行数:8,
示例19: mymq_timedreceivessize_t mymq_timedreceive(mqd_t __mqdes, CHAR_PTR __msg_ptr, size_t __msg_len, UNSIGNED_PTR __msg_prio, const STRUCT_TIMESPEC_PTR __abs_timeout){ OutFile << CurrentTime() << "mymq_timedreceive called " << endl; OutFile.flush(); ssize_t res = fptrmq_timedreceive( __mqdes, __msg_ptr, __msg_len, __msg_prio, __abs_timeout); return res;}
开发者ID:asudhak,项目名称:peachfuzz-code,代码行数:8,
示例20: mymq_receivessize_t mymq_receive(mqd_t __mqdes, CHAR_PTR __msg_ptr, size_t __msg_len, UNSIGNED_PTR __msg_prio){ OutFile << CurrentTime() << "mymq_receive called " << endl; OutFile.flush(); ssize_t res = fptrmq_receive( __mqdes, __msg_ptr, __msg_len, __msg_prio); return res;}
开发者ID:asudhak,项目名称:peachfuzz-code,代码行数:8,
示例21: mymq_openmqd_t mymq_open(const CHAR_PTR __name, int __oflag){ OutFile << CurrentTime() << "mymq_open called " << endl; OutFile.flush(); mqd_t res = fptrmq_open(__name, __oflag); return res;}
开发者ID:asudhak,项目名称:peachfuzz-code,代码行数:8,
示例22: mygetchint mygetch(void){ OutFile << CurrentTime() << "mygetch called " << endl; OutFile.flush(); int res = fptrgetch(); return res;}
开发者ID:EmilyBragg,项目名称:profiling-tool,代码行数:8,
示例23: mymvgetchint mymvgetch(int y, int x){ OutFile << CurrentTime() << "mymvgetch called " << endl; OutFile.flush(); int res = fptrmvgetch(y, x); return res;}
开发者ID:EmilyBragg,项目名称:profiling-tool,代码行数:8,
示例24: myCryptDecryptBOOL WINAPI myCryptDecrypt(HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen) { FILE *fd = fopen("C://CryptoBlock32.txt", "a"); std::string mytime = CurrentTime(); fprintf(fd, "%s myCryptDecrypt(%x,%x,%x,%x,%p,%p)/n", mytime.c_str(), hKey, hHash, Final, dwFlags, pbData, pdwDataLen); fclose(fd); return Real_CryptDecrypt(hKey, hHash, Final, dwFlags, pbData, pdwDataLen);}
开发者ID:raghavendravp,项目名称:Charlie-2,代码行数:8,
示例25: myCryptAcquireContextBOOL WINAPI myCryptAcquireContext(HCRYPTPROV *phProv, LPCTSTR pszContainer, LPCTSTR pszProvider, DWORD dwProvType, DWORD dwFlags) { FILE *fd = fopen("C://CryptoBlock32.txt", "a"); std::string mytime = CurrentTime(); fprintf(fd, "%s myCryptAcquireContext(%p,%s,%s,%x,%x)/n", mytime.c_str(), phProv, pszContainer, pszProvider, dwProvType, dwFlags); fclose(fd); return Real_CryptAcquireContext(phProv, pszContainer, pszProvider, dwProvType, dwFlags);}
开发者ID:raghavendravp,项目名称:Charlie-2,代码行数:8,
示例26: myclock_nanosleepint myclock_nanosleep(clockid_t __clock_id, int __flags, const STRUCT_TIMESPEC_PTR __rqtp, STRUCT_TIMESPEC_PTR __rmtp){ OutFile << CurrentTime() << "myclock_nanosleep called " << endl; OutFile.flush(); int res = fptrclock_nanosleep(__clock_id, __flags, __rqtp, __rmtp); return res;}
开发者ID:asudhak,项目名称:peachfuzz-code,代码行数:8,
示例27: mymq_timedsendint mymq_timedsend(mqd_t __mqdes, const CHAR_PTR __msg_ptr, size_t __msg_len, unsigned __msg_prio, const STRUCT_TIMESPEC_PTR __abs_timeout){ OutFile << CurrentTime() << "mymq_timedsend called " << endl; OutFile.flush(); int res = fptrmq_timedsend(__mqdes, __msg_ptr, __msg_len, __msg_prio, __abs_timeout); return res;}
开发者ID:asudhak,项目名称:peachfuzz-code,代码行数:8,
示例28: TotalTimevoid MusicPlayer::UpdateDuration(qint64 time){ int duration=this->duration/1000; QTime TotalTime((duration/3600)%60, (duration/60)%60, duration%60, (duration*1000)%1000); QTime CurrentTime((time/3600)%60, (time/60)%60, time%60, (time*1000)%1000); QString temp = CurrentTime.toString("mm:ss") + " / " + TotalTime.toString("mm:ss"); ui->duration_label->setText(temp);}
开发者ID:insectoman,项目名称:MusicPlayer,代码行数:8,
注:本文中的CurrentTime函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ Cursor函数代码示例 C++ CurrentSelection函数代码示例 |