make calibration cache expire after one hour

merge-requests/1/head
Stphane Voltz 2010-10-30 16:21:39 +02:00
rodzic 413f0df3a1
commit ea95ab9b7f
1 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -3952,6 +3952,9 @@ gl847_is_compatible_calibration (Genesys_Device * dev,
Genesys_Calibration_Cache * cache,
int for_overwrite)
{
#ifdef HAVE_SYS_TIME_H
struct timeval time;
#endif
SANE_Status status;
DBG (DBG_proc, "gl847_is_compatible_calibration\n");
@ -3971,6 +3974,19 @@ gl847_is_compatible_calibration (Genesys_Device * dev,
if (dev->current_setup.half_ccd != cache->used_setup.half_ccd)
return SANE_STATUS_UNSUPPORTED;
/* a cache entry expires after 60 minutes for non sheetfed scanners */
#ifdef HAVE_SYS_TIME_H
gettimeofday (&time, NULL);
if ((time.tv_sec - cache->last_calibration > 60 * 60)
&& (dev->model->is_sheetfed == SANE_FALSE)
&& (dev->settings.scan_method == SCAN_METHOD_FLATBED))
{
DBG (DBG_proc,
"gl847_is_compatible_calibration: expired entry, non compatible cache\n");
return SANE_STATUS_UNSUPPORTED;
}
#endif
DBG (DBG_proc, "gl847_is_compatible_calibration: completed\n");
return SANE_STATUS_GOOD;