+ // Note: Call before open, not after; otherwise, there's a race.
+ // (There is now, too, but it tips the correct way. We could use fstat()
+ // if we had the file descriptor.)
+ timespec last_modified;
+ struct stat buf;
+ if (stat(pathname.c_str(), &buf) != 0) {
+ // Probably some sort of protocol, so can't stat.
+ last_modified.tv_sec = -1;
+ } else {
+ last_modified = buf.st_mtim;
+ }
+