On Monday 15 July 2002 5:21 pm, Jean-Marc Lasgouttes wrote: > >>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes: > > Angus> I plead great ignorance. how efficient is crc? Would there not > Angus> be a big performance penalty if I used lyx::sum(file) every > Angus> time I poled the file? (Every couple of seconds...) > > It is as efficient as possible :) I know it uses mmap when relevant. > Now, I can't tell the time it takes on a 50M image file... > > JMarc
Well, we can use both pieces of info. FileInfo finfo(file); int const timestamp = finfo.getModificationTime(); if (timestamp != stored_timestamp) { stored_timestamp = timestamp; int const checksum = lyx::sum(file); if (checksum != stored_checksum) { stored_checksum = checksum; // reload graphic ... } } timer.restart(); I have another, more philosophical question: what should we do if the reloading process fails? Should we continue to show the original file or should be display the little box "Error Loading File"? Personally, I'd prefer the Error (as it'll be rather hard to use the image file in a LaTeX run!) It'll also be easier to code as we'd just call GraphicsCacheItem::startLoading() and let it get on with it! Thoughts? Angus