Use gettimeofday instead of clock_gettime.

POSIX.1-2008 deprecates gettimeofday...
So perhaps it will be changed back in future.

For now gettimeofday is more portable :(
This commit is contained in:
Alexey Sokolov
2012-08-09 00:37:16 +07:00
parent 54f558a4ee
commit d37cb447a0
6 changed files with 21 additions and 22 deletions

View File

@@ -122,9 +122,9 @@ public:
{
CString sTimestamp = sLine.Token(0);
sTimestamp.TrimLeft("@");
timespec ts;
timeval ts;
ts.tv_sec = sTimestamp.Token(0, false, ",").ToLongLong();
ts.tv_nsec = sTimestamp.Token(1, false, ",").ToLong();
ts.tv_usec = sTimestamp.Token(1, false, ",").ToLong();
CString sFormat = sLine.Token(1, true);
@@ -171,9 +171,9 @@ public:
unsigned int uSize = Buffer.Size();
for (unsigned int uIdx = 0; uIdx < uSize; uIdx++) {
const CBufLine& Line = Buffer.GetBufLine(uIdx);
timespec ts = Line.GetTime();
timeval ts = Line.GetTime();
sFile +=
"@" + CString(ts.tv_sec) + "," + CString(ts.tv_nsec) + " " +
"@" + CString(ts.tv_sec) + "," + CString(ts.tv_usec) + " " +
Line.GetFormat() + "\n" +
Line.GetText() + "\n";
}