git-svn-id: svn://db.shs.com.ru/pip@260 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -80,6 +80,16 @@ bool PIBinaryLog::openDevice() {
|
||||
if (path().isEmpty() && mode_ == WriteOnly) {
|
||||
setPath(getLogfilePath());
|
||||
}
|
||||
if (path().isEmpty() && mode_ == ReadOnly) {
|
||||
PIDir ld(logDir());
|
||||
if (ld.isExists()) {
|
||||
PIVector<PIFile::FileInfo> es = ld.allEntries();
|
||||
piForeachC(PIFile::FileInfo &i, es) {
|
||||
if (i.extension() == "binlog" && i.isFile())
|
||||
setPath(i.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!file.open(path(), mode_)) {
|
||||
piCoutObj << "Error: Can't open file" << path();
|
||||
return false;
|
||||
@@ -129,6 +139,8 @@ bool PIBinaryLog::closeDevice() {
|
||||
|
||||
|
||||
bool PIBinaryLog::threadedRead(uchar *readed, int size) {
|
||||
// piCout << "binlog threaded read";
|
||||
if (!canRead() || isEnd()) return PIIODevice::threadedRead(readed, size);
|
||||
is_thread_ok = false;
|
||||
PISystemTime pt;
|
||||
double delay;
|
||||
@@ -136,6 +148,8 @@ bool PIBinaryLog::threadedRead(uchar *readed, int size) {
|
||||
case PlayRealTime:
|
||||
pt = PISystemTime::current() - startlogtime;
|
||||
if (is_started) {
|
||||
if ((lastrecord.timestamp - pt).toSeconds() > 100. || (lastrecord.timestamp - pt).toSeconds() < -100.)
|
||||
piCoutObj << PISystemTime::current() << startlogtime << pt << lastrecord.timestamp << (lastrecord.timestamp - pt);
|
||||
if (lastrecord.timestamp > pt)
|
||||
(lastrecord.timestamp - pt).sleep();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user