Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: svn://sisp.smith.man.ac.uk/svn/rattray/bitseq/cpp@56 c4856536-7db2-4565-afe3-bcf1ab8f3238
- Loading branch information
mbaxjpg3
committed
Jul 5, 2013
1 parent
14a6b68
commit cbc3811
Showing
29 changed files
with
963 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include<ctime> | ||
|
||
#include "MyTimer.h" | ||
|
||
#include "common.h" | ||
|
||
void MyTimer::adjust(double &time,char f){//{{{ | ||
if(f=='m')time/=60.0; | ||
if(f=='h')time/=3600.0; | ||
}//}}} | ||
void MyTimer::write(double time,char f){//{{{ | ||
if(!quiet)messageF("[time: +%lf %c]\n",time,f); | ||
}//}}} | ||
MyTimer::MyTimer(){//{{{ | ||
N=1; | ||
quiet=false; | ||
times.resize(N); | ||
times[0]=time(NULL); | ||
}//}}} | ||
void MyTimer::start(long timer){//{{{ | ||
if(timer>=N){ | ||
N=timer+1; | ||
times.resize(N); | ||
} | ||
times[timer]=time(NULL); | ||
}//}}} | ||
double MyTimer::split(long timer, char f){//{{{ | ||
if(timer>=N)return 0; | ||
double ret; | ||
ret=time(NULL)-times[timer]; | ||
adjust(ret,f); | ||
write(ret,f); | ||
times[timer]=time(NULL); | ||
return ret; | ||
}//}}} | ||
double MyTimer::current(long timer, char f){//{{{ | ||
if(timer>=N)return 0; | ||
double ret; | ||
ret=time(NULL)-times[timer]; | ||
adjust(ret,f); | ||
write(ret,f); | ||
return ret; | ||
}//}}} | ||
double MyTimer::stop(long timer, char f){//{{{ | ||
if(timer>=N)return 0; | ||
double ret; | ||
ret=time(NULL)-times[timer]; | ||
adjust(ret,f); | ||
write(ret,f); | ||
times[timer]=time(NULL); | ||
return ret; | ||
}//}}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.