diff options
author | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2016-12-31 08:12:51 (GMT) |
---|---|---|
committer | Elliott Sales de Andrade <quantum.analyst@gmail.com> | 2017-09-16 07:54:10 (GMT) |
commit | 5fcdcf95cb62ab3d593c36ef90df27cef63874a1 (patch) | |
tree | 734cfe5426f48e5a0e19d5fa00e7bd2827337ee1 /src/deps_log.cc | |
parent | 87111bff382655075f2577c591745a335f0103c7 (diff) | |
download | Ninja-5fcdcf95cb62ab3d593c36ef90df27cef63874a1.zip Ninja-5fcdcf95cb62ab3d593c36ef90df27cef63874a1.tar.gz Ninja-5fcdcf95cb62ab3d593c36ef90df27cef63874a1.tar.bz2 |
Make TimeStamp 64-bit.
This prepares it for higher-resolution timestamps.
Diffstat (limited to 'src/deps_log.cc')
-rw-r--r-- | src/deps_log.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/deps_log.cc b/src/deps_log.cc index 89c6023..d7f0b26 100644 --- a/src/deps_log.cc +++ b/src/deps_log.cc @@ -30,7 +30,7 @@ // The version is stored as 4 bytes after the signature and also serves as a // byte order mark. Signature and version combined are 16 bytes long. const char kFileSignature[] = "# ninjadeps\n"; -const int kCurrentVersion = 3; +const int kCurrentVersion = 4; // Record size is currently limited to less than the full 32 bit, due to // internal buffers having to have this size. @@ -124,7 +124,7 @@ bool DepsLog::RecordDeps(Node* node, TimeStamp mtime, return true; // Update on-disk representation. - unsigned size = 4 * (1 + 1 + node_count); + unsigned size = 4 * (1 + 2 + node_count); if (size > kMaxRecordSize) { errno = ERANGE; return false; @@ -135,8 +135,7 @@ bool DepsLog::RecordDeps(Node* node, TimeStamp mtime, int id = node->id(); if (fwrite(&id, 4, 1, file_) < 1) return false; - int timestamp = mtime; - if (fwrite(×tamp, 4, 1, file_) < 1) + if (fwrite(&mtime, 8, 1, file_) < 1) return false; for (int i = 0; i < node_count; ++i) { id = nodes[i]->id(); @@ -218,9 +217,9 @@ bool DepsLog::Load(const string& path, State* state, string* err) { assert(size % 4 == 0); int* deps_data = reinterpret_cast<int*>(buf); int out_id = deps_data[0]; - int mtime = deps_data[1]; - deps_data += 2; - int deps_count = (size / 4) - 2; + TimeStamp mtime = reinterpret_cast<TimeStamp*>(&deps_data[1])[0]; + deps_data += 3; + int deps_count = (size / 4) - 3; Deps* deps = new Deps(mtime, deps_count); for (int i = 0; i < deps_count; ++i) { |