加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
global.cpp 22.22 KB
一键复制 编辑 原始数据 按行查看 历史
goldbeef 提交于 2014-05-19 18:47 . Create global.cpp
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954
#include "global.h"
#include "wzip.h"
#include "fileProcess.h"
#include "parameter.h"
#include "compress.h"
#include "errProcess.h"
#include "blocksort.h"
#include "huffman.h"
#include "hutacker.h"
#include "balance.h"
#include "wavelet.h"
#include "rleElisCode.h"
#include "decompress.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <signal.h>
#define BUFF_SIZE 4096
//paramter
//-c :compress
//-d :decompress
//-b :blksize
int blockSiz=9;//1-9
//-e :tree type
int treeType=3;//1-3
//-g :nodeCOde
int nodeCode=1;//1-2
//-v :verbose level
int verbose=0;//0-2
//-p : number of thread
int nthread=2;//1,2,4
//-k: keep orignal file
int keepOrigFile=0;//0,1
//-f: force to overwrite outputfile
int overWrite=0;//0,1
//-h:help manul
//-l:license
int workState=-1;//1,2
// compress :
// wzip -c [-b blksize] [-e treetype] [-g node] [-k] [-f] [-p #thread] [-v verbose]filename
// decompress:
// wzip -d [-k ] [ -f ] [-v verbose ]filename
// helpInfo :
// wzip [-h]
// license :
// wzip [-l]
fileInfo_t fileInfo;
//thread[0] is for main thread.
threadInfo_t threadInfos[MAX_THREADS+1];
pthread_mutex_t mutex=PTHREAD_MUTEX_INITIALIZER;
void sig_int_compress(int signo){
char fileName[MAX_FILE_LEN];
printf("wzip interrupted unexpectedly,do some cleanup\n");
int i;
for(i=1;i<=nthread;i++){
sprintf (fileName,"%s.wz.%i",fileInfo.orgfileName,i);
printf("remove %s\n",fileName);
unlink (fileName);
}
sprintf (fileName,"%s.wz",fileInfo.orgfileName);
unlink(fileName);
exit(0);
}
void sig_int_decompress(int signo){
printf("wzip interrupted unexpectedly,do some cleanup\n");
char fileName[MAX_FILE_LEN];
filenameMap (fileInfo.orgfileName,fileName,DECPRESS);
unlink(fileName);
printf("remove %s\n",fileName);
exit(0);
}
void printfHelp(void){
printf("compress:\n"
"\twzip -c [-b blksize] [-e treetype] [-g node] [-k] [-f] "
"[-p #thread] [-v verbose] filename\n"
"decompress:\n"
"\twzip -d [-k ] [ -f ] [-v ] [-v verbose ]filename\n"
"helpInfo:\n"
"\twzip [-h]\n"
"license:\n"
"\twzip [-L]\n"
);
}
void printfManul(void){
system ("cat manul.txt|more");
exit(0);
}
void printLicense(void){
system ("cat README|more");
exit(0);
}
void showGlobalValue(void){
printf ("Global value:\n");
printf ("\tblockSize=%d\n",blockSiz);
printf ("\ttreeType=%d\n",treeType);
printf("\tcodeType=%d\n",nodeCode);
printf("\tverbose=%d\n",verbose);
printf("\tnthread=%d\n",nthread);
printf ("\tkeepOrigFile=%d\n",keepOrigFile);
printf("\toverWrite=%d\n",overWrite);
printf ("\tworkStat=%d\n",workState);
printf ("fileName=%s\n",fileInfo.orgfileName);
}
int getParameters (int argc, char *argv[])
{
int c;
while((c=getopt (argc,argv,"b:e:g:v:p:kfhldc"))
!=-1
)
{
switch(c){
case 'b':
//printf("option -b\n");
blockSiz=atoi(optarg);
if(blockSiz<=0 ||
blockSiz>9
){
printf ("blockSize should within [1-9]\n");
return ERR_PARAMETER;
}
break;
case 'e':
treeType=atoi(optarg);
if(treeType<=0||
treeType>3
){
printf ("treetype should within [1-3]\n");
return ERR_PARAMETER;
}
break;
case 'g':
nodeCode=atoi(optarg);
if(nodeCode<=0||
nodeCode>2
){
printf ("nodeCode should within [1-2]\n");
return ERR_PARAMETER;
}
break;
case 'v':
verbose=atoi(optarg);
if(verbose<0||
verbose>2
){
printf ("verbose should witin [0-2]\n");
return ERR_PARAMETER;
}
break;
case 'k':
keepOrigFile=1;
break;
case 'f':
overWrite=1;
break;
case 'c':
if(workState==-1){
workState=0;
}else if(workState==0){
printf("more than two option -c \n");
return ERR_PARAMETER;
}else{
printf("can't have both option -d and option -c \n");
return ERR_PARAMETER;
}
break;
case 'd':
if(workState==-1){
workState=1;
}else if(workState==0){
printf("can't have both option -d and option -c \n");
return ERR_PARAMETER;
}else{
printf ("more than two option -d\n");
return ERR_PARAMETER;
}
break;
case 'p':
nthread=atoi(optarg);
if(nthread<=0 ||
nthread>4
){
printf ("nthread should with [1-4]\n");
return ERR_PARAMETER;
}
break;
case 'h':
printfHelp ();
//exit in advance
exit(0);
break;
case 'l':
printLicense ();
//exit in advance
exit(0);
break;
}
}
if(optind!=argc-1){
return ERR_PARAMETER;
}
strcpy (fileInfo.orgfileName,argv[optind]);
return 0;
}
int writeCompressArguments(FILE *zipFile)
{
if (!zipFile)
{
return ERR_PARAMETER;
}
uchar blkSiz100k;
uchar nodeType;
blkSiz100k=blockSiz;
nodeType =nodeCodeTypeMap (nodeCode);
//printf("blkSize,pos=%d",ftell(zipFile));
fwrite(&blkSiz100k,sizeof(uchar),1,zipFile);
//printf("nodeType,pos=%d",ftell(zipFile));
fwrite(&nodeType,sizeof(uchar),1,zipFile);
return 0;
}
//init fileInfo and write zipFileHeader
int mainThreadCompressInit(void)
{
int ret;
int i;
ret=filenameMap(fileInfo.orgfileName,
fileInfo.zipFileName,
COMPRESS
);
if (ret<0)
{
return ERR_FILE_NAME;
}
FILE *infile=myFileSafeOpen(fileInfo.orgfileName,"rb");
if(infile==NULL){
return ERR_IO;
}
fileInfo.orgFileSize=getFileSize(infile);
fclose(infile);
if(stat(fileInfo.orgfileName,&fileInfo.fileStat)<0){
printf("stat error\n");
return ERR_FILE_NAME;
}
if(!keepOrigFile && fileInfo.fileStat.st_nlink>1){
printf("%s has more than one hard-link,may be you need -k option!",
fileInfo.orgfileName
);
exit(0);
}
fileInfo.totalBlks=fileInfo.orgFileSize/(100000*blockSiz)+\
(fileInfo.orgFileSize%(100000*blockSiz)?1:0)
;
// printf("totalBlks :%d\n",fileInfo.totalBlks);
if(fileInfo.totalBlks<nthread){
nthread=fileInfo.totalBlks;
}
fileInfo.accCompress=0;
fileInfo.bitsPerChar=0;
fileInfo.ratio=0;
int blksPerThread=fileInfo.totalBlks/nthread;
//printf ("blksPerThread:%d\n",blksPerThread);
for(i=1;i<=nthread;i++){
memset (&threadInfos[i],0,sizeof(threadInfo_t));
threadInfos[i].nblocks=blksPerThread;
}
int ncurBlks=blksPerThread*nthread;
//printf ("ncurBlks=%d\n",ncurBlks);
while(ncurBlks<fileInfo.totalBlks){
threadInfos[(ncurBlks%nthread)+1].nblocks++;
ncurBlks++;
}
#if 0
//for show nblks of thread
for(i=1;i<=nthread;i++){
printf("thread %d: %d\n",i,threadInfos[i].nblocks);
}
#endif
//set the file offset
unsigned int pos=0;
for(i=1;i<=nthread;i++){
threadInfos[i].fileOffset=pos;
pos+=threadInfos[i].nblocks*blockSiz*100000;
}
#if 0
//for show file offset
for(i=1;i<=nthread;i++){
printf("thread %i: %u\n",i,threadInfos[i].fileOffset);
}
#endif
//check weather outfile already exist
struct stat temp;
if(stat(fileInfo.zipFileName,&temp)==0 &&
!overWrite
){
printf("%s has already exist,you may need -f option to overwrite\n",
fileInfo.zipFileName
);
exit(0);
}
FILE *oufile;
//write wzip header
oufile=fopen (fileInfo.zipFileName,"wb");
if(!oufile){
printf("open %s error\n",fileInfo.zipFileName);
return ERR_FILE_NAME;
}
//printf("zipHeader,pos=%d\n",ftell(oufile));
ret=writeFileHeader(oufile);
if (ret<0)
{
errProcess("writeFileHeader",ret);
exit(0);
}
// printf("zipArgs,pos=%d\n",ftell(oufile));
ret=writeCompressArguments(oufile);
if (ret<0)
{
errProcess("writeCompress",ret);
exit(0);
}
fclose(oufile);
return 0;
}
//init stream Before compress
int threadBlkInit(Stream_t *streamPtr,int index){
int ret;
streamPtr->workState=workState?DECPRESS:COMPRESS;
streamPtr->blkSiz100k=blockSiz;
streamPtr->treeShape=shapeMap(treeType);
streamPtr->nodeCode=nodeCodeTypeMap(nodeCode);
strcpy(streamPtr->infileName,fileInfo.orgfileName);
sprintf (streamPtr->oufileName,"%s.%d",fileInfo.zipFileName,index);
streamPtr->infile=myFileSafeOpen(streamPtr->infileName,"rb");
if(streamPtr->infile==NULL){
return ERR_IO;
}
streamPtr->oufile=myFileSafeOpen(streamPtr->oufileName,"wb");
if(streamPtr->oufile==NULL){
return ERR_IO;
}
streamPtr->curBlkSeq=0;
streamPtr->blkOrigSiz=0;
streamPtr->blkAfterSiz=0;
streamPtr->verboseLevel=verbose;
streamPtr->myAlloc=malloc;
streamPtr->myFree=free;
streamPtr->inbuff=(uchar*)streamPtr->myAlloc(streamPtr->blkSiz100k\
*100000+sizeof(uchar)+OVERSHOOT
);
if(streamPtr->inbuff==NULL){
return ERR_MEMORY;
}
streamPtr->outbuff=(uchar*)streamPtr->myAlloc(streamPtr->blkSiz100k\
*100000*2
);
if(streamPtr->outbuff==NULL){
return ERR_MEMORY;
}
streamPtr->suffixArray=(u32*)streamPtr->myAlloc(streamPtr->blkSiz100k\
*100000*sizeof(u32)+sizeof(u32)
);
if(streamPtr->suffixArray==NULL){
return ERR_MEMORY;
}
streamPtr->bwt=(uchar *)streamPtr->myAlloc(streamPtr->blkSiz100k\
*100000+sizeof(uchar)
);
if (streamPtr->bwt==NULL)
{
return ERR_MEMORY;
}
memset(streamPtr->charMap,0,sizeof(streamPtr->charMap));
memset(streamPtr->charFreq,0,sizeof(streamPtr->charFreq));
memset(streamPtr->codeTable,0,CHAR_SET_SIZE*CODE_MAX_LEN);
streamPtr->totalInHig32=0;
streamPtr->totalInLow32=0;
streamPtr->totalOuHig32=0;
streamPtr->totalOuLow32=0;
streamPtr->root=NULL;
streamPtr->accCpuTime=0;
streamPtr->accBitsPerChar=-1;
streamPtr->accRatio=-1;
//very important
fseek (streamPtr->infile,threadInfos[index].fileOffset,SEEK_SET);
return 0;
}
void *childThread(void *arg){
int ret;
int index=(int )arg;
if(gettimeofday (&threadInfos[index].startTime,NULL)<0){
printf("gettimeofday error\n");
exit(0);
}
Stream_t stream;
ret=threadBlkInit (&stream,index);
if(ret<0){
printf("threadBlkInit\n");
exit(0);
}
u32 nread;
int blkCount=0;
while (!feof(stream.infile)
&&
blkCount<threadInfos[index].nblocks
)
{
blkCount++;//important
nread=stream.blkSiz100k*100000;
ret=myFileRead(stream.infile,&nread,stream.inbuff);
if (ret<0)
{
errProcess("myFileRead",ret);
exit(0);
}
stream.blkOrigSiz=nread+1;
stream.inbuff[stream.blkOrigSiz-1]='\0';
if (stream.blkOrigSiz==1)
{
//eof
break;
}
//for test
//while computing the suffix array,the lib may use global varbile
pthread_mutex_lock (&mutex);
ret=blockSort(stream.inbuff,
stream.suffixArray,
stream.blkOrigSiz,/*must be blkSize */
&(stream.bwtIndex)
);
pthread_mutex_unlock (&mutex);
if (ret<0)
{
errProcess("blockSort",ret);
exit(0);
}
ret=getBwtTransform(stream.inbuff,stream.suffixArray,
stream.bwt,stream.blkOrigSiz
);
if (ret<0)
{
errProcess("getBwtTransform",ret);
exit(0);
}
ret=treeCode(stream.bwt,stream.blkOrigSiz,
stream.treeShape,&stream
);
if (ret<0)
{
errProcess("treeCode",ret);
exit(0);
}
#if 0
//show codeTable
int i;
for(i=0;i<CHAR_SET_SIZE;i++){
if(strlen (stream.codeTable[i])){
printf("%d= %s\n",i,stream.codeTable[i]);
}
}
#endif
waveletTree root=createWaveletTree(stream.bwt,
stream.blkOrigSiz,
stream.codeTable
);
if (!root)
{
errProcess("createWaveletTree",ERR_MEMORY);
exit(0);
}
stream.root=root;//set the element of stream
//compress bits-vector of wavelet tree
ret=compressWaveletTree(stream.root,stream.nodeCode);
if (ret<0)
{
errProcess("compressWaveletTree",ret);
exit(0);
}
int zipLen=computeZipSizWaveletTree(stream.root);
if (zipLen<0)
{
errProcess("computeZipSizWaveletTree",zipLen);
exit(0);
}
//printf("charSet,pos=%d\n",ftell(stream.oufile));
ret=writeBlkCharSetMap(&stream);
if (ret<0)
{
errProcess("writeBlkCharSetMap",ret);
exit(0);
}
//printf("codeTable,pos=%d\n",ftell(stream.oufile));
ret=writeBlkCharCodeTable(&stream);
if (ret<0)
{
errProcess("writeBlkCharCodeTable",ret);
exit(0);
}
//printf("bwtIndex,pos=%d\n",ftell(stream.oufile));
ret=writeBlkBwtIndex(&stream);
if (ret<0)
{
errProcess("writeBlkBwtIndex",ret);
exit(0);
}
//printf("zipData,pos=%d\n",ftell(stream.oufile));
ret=writeBlkZipNodeWithPreorder(&stream);
if (ret<0)
{
errProcess("writeBlkZipNodeWithPreorder",ret);
exit(0);
}
stream.totalInLow32+=stream.blkOrigSiz;
if (stream.totalInLow32<stream.blkOrigSiz)
{
//means totalInlow overflow
stream.totalInHig32++;
}
stream.totalOuLow32+=zipLen;
if (stream.totalOuLow32<zipLen)
{
//means totalOuLow overflow
stream.totalOuHig32++;
}
ret=destroyWaveletTree(stream.root);
if (ret<0)
{
errProcess("destroyWaveletTree",ret);
exit(0);
}
stream.root=NULL;
}
ret=streamBlkCompressCleanUp(&stream);
if (ret<0)
{
errProcess("streamBlkCleanUp",ret);
exit(0);
}
if(gettimeofday (&threadInfos[index].endTime,NULL)<0){
printf("gettimeofday error\n");
exit(0);
}
}
void compressMainThread(void){
int ret;
char fileName[MAX_FILE_LEN];
if(signal (SIGINT,sig_int_compress)==SIG_ERR){
printf("signal error\n");
exit(0);
}
if(gettimeofday (&(threadInfos[0].startTime),NULL)<0)
{
printf("gettimeofday error\n");
exit(0);
}
ret=mainThreadCompressInit();
if(ret<0){
printf ("mainThreadCompress error\n");
exit(0);
}
int i;
for(i=1;i<=nthread;i++){
if(pthread_create (&threadInfos[i].threadId,
NULL,
childThread,
(void*)i
)
<0
){
printf("pthread_create error\n");
exit(0);
}
}
for(i=1;i<=nthread;i++){
if(pthread_join (threadInfos[i].threadId,
NULL
)
<0
){
printf("pthread_join error\n");
exit(0);
}
}
//mergeFiles
FILE *zipFile=fopen (fileInfo.zipFileName,"ab+");
if(!zipFile){
printf ("fopen error\n");
exit(0);
}
FILE *tempFile;
uchar buff[BUFF_SIZE];
u32 nread;
//printf("Merge files Start\n");
for(i=1;i<=nthread;i++){
sprintf (fileName,"%s.%d",fileInfo.zipFileName,i);
//open file
tempFile=fopen(fileName,"rb");
if(!tempFile){
printf("fopen %s error\n",fileName);
exit(0);
}
while (!feof(tempFile)){
nread=sizeof(buff);
//printf("%d\n",ftell(stream.oufile));
ret=myFileRead(tempFile,&nread,buff);
if (ret<0)
{
errProcess("myFileRead",ret);
exit(0);
}
//printf("zipSegOf=%s",ftell(zipFile));
fwrite (buff,sizeof(uchar),nread,zipFile);
}
//eof
fclose(tempFile);
//remove tempfile
unlink (fileName);
}
writeFileEnd(zipFile);
if(gettimeofday (&(threadInfos[0].endTime),NULL)<0)
{
printf("gettimeofday error\n");
exit(0);
}
struct stat tempBuff;
if(verbose==1){
printf("compress done.\n");
}else if (verbose==2){
if(stat(fileInfo.zipFileName,&tempBuff)!=0){
printf("stat error\n");
exit(0);
}
printf("compress done.\n");
printf("\tratio:%.3f%%,\tbits/char:%.3f\n",
tempBuff.st_size*100.0/fileInfo.orgFileSize,
tempBuff.st_size*8.0/fileInfo.orgFileSize
);
struct timeval tmpTime;
tmpTime.tv_sec=threadInfos[0].endTime.tv_sec - \
threadInfos[0].startTime.tv_sec;
tmpTime.tv_usec=threadInfos[0].endTime.tv_usec- \
threadInfos[0].startTime.tv_usec;
if(tmpTime.tv_usec<0){
tmpTime.tv_sec--;
tmpTime.tv_usec+=1000000;
}
#if 1
printf("real time of mainThread:%.3f(s)\n",
tmpTime.tv_sec+tmpTime.tv_usec/1000000.0
);
#endif
}
//remove the orignal file
if(!keepOrigFile){
unlink (fileInfo.orgfileName);
}
fclose(zipFile);
}
void decompressMainThread(void){
int ret;
Stream_t stream;
stream.workState=DECPRESS;
if(signal (SIGINT,sig_int_decompress)==SIG_ERR){
printf("signal error\n");
exit(0);
}
strcpy (stream.infileName,fileInfo.orgfileName);
if(gettimeofday (&threadInfos[0].startTime,NULL)!=0)
{
printf("gettimeofday error\n");
exit(0);
}
ret=streamBlkDecompressInit(&stream);
if (ret<0)
{
errProcess("streamBlkDecompressInit",ret);
exit(0);
}
long pos;
while (1)
{
pos=ftell(stream.infile);
#if 0
printf("Decompress ... %.3f%%\r",
(double)pos/stream.fileSize*100
);
#endif
if (stream.fileSize-pos==FILE_HEAD_LEN)
{
break;
}
ret=paraseBlkCharSetMap(stream.infile,&stream);
if (ret<0)
{
//error
errProcess("paraseBlkCharSetMap",ret);
streamBlkCompressCleanUp(&stream);
exit(0);
}
ret=paraseBlkCharCodeTable(stream.infile,&stream);
if (ret<0)
{
errProcess("praseBlkCharCodeTable",ret);
exit(0);
}
ret=paraseBlkBwtIndex(stream.infile,&stream);
if (ret<0)
{
errProcess("paraseBlkBwtIndex",ret);
exit(0);
}
stream.root=genWavtreeWithCodeTable(stream.codeTable);
if (!stream.root)
{
errProcess("genWavtreeWithCodeTable",ERR_MEMORY);
exit(0);
}
ret=paraseBlkZipNodeWithPreorder(stream.infile,
stream.root,
&stream
);
if (ret<0)
{
errProcess("paraseBlkZipNodeWithPreorder",ret);
exit(0);
}
ret=genBwtWithWaveletTree(stream.root,&stream);
if (ret<0)
{
errProcess("generateBwtWithWaveletTree",ret);
exit(0);
}
ret=genOrigBlkWithBwt(stream.bwt,
stream.blkOrigSiz,
stream.bwtIndex,
stream.inbuff
);
if (ret<0)
{
errProcess("genOrigBlkWithBwt",ret);
exit(0);
}
ret=streamWriteOrigBlk(&stream);
if (ret<0)
{
errProcess("streamWriteOrigBlk",ret);
exit(0);
}
//very important
destroyWaveletTree(stream.root);
stream.root=NULL;
}
#if 0
printf("Decompress ... ...100.00%\n");
#endif
streamBlkDecompressCleanUp(&stream);
if(!keepOrigFile){
unlink (stream.infileName);
}
if(gettimeofday (&threadInfos[0].endTime,NULL)!=0)
{
printf("gettimeofday error\n");
exit(0);
}
if(verbose==1){
printf("decompress done.\n");
}else if (verbose==2){
printf("decompress done.\n");
struct timeval tmpTime;
tmpTime.tv_sec=threadInfos[0].endTime.tv_sec - \
threadInfos[0].startTime.tv_sec;
tmpTime.tv_usec=threadInfos[0].endTime.tv_usec- \
threadInfos[0].startTime.tv_usec;
if(tmpTime.tv_usec<0){
tmpTime.tv_sec--;
tmpTime.tv_usec+=1000000;
}
#if 1
printf("real time of mainThread:%.3f(s)\n",
tmpTime.tv_sec+tmpTime.tv_usec/1000000.0
);
}
#endif
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化