From e24467a405400dd4cb2267a625df086d3eea6394 Mon Sep 17 00:00:00 2001
From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Wed, 10 Dec 2003 21:59:42 +0000
Subject: [PATCH] Allow testing once per year if user wants it.

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@1363 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/NEWS       | 10 ++++++++--
 sm5/smartd.c   |  4 ++--
 sm5/smartd.cpp |  4 ++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/sm5/NEWS b/sm5/NEWS
index 3278fc431..9e87c915b 100644
--- a/sm5/NEWS
+++ b/sm5/NEWS
@@ -1,14 +1,20 @@
 smartmontools NEWS
 ------------------
-CVS ID: $Id: NEWS,v 1.13 2003/11/28 23:42:04 ballen4705 Exp $
+CVS ID: $Id: NEWS,v 1.14 2003/12/10 21:59:42 ballen4705 Exp $
 
 The most up-to-date version of this file is:
 http://cvs.sourceforge.net/viewcvs.py/smartmontools/sm5/NEWS?sortby=date&view=markup
 
+Date: 
+Summary: smartmontools release 5.27
+-----------------------------------
+A new Directive (-s) for smartd.conf now enables flexible automatic
+scheduled self-testing for both ATA and SCSI devices.
+
 Date: 2003-11-29
 Summary: smartmontools release 5.26
 -----------------------------------
-This is intended to be a stable release.
+This is a stable smartmontools release, with no known problems.
 
 Date: 2003-11-19
 Summary: smartmontools release 5.25
diff --git a/sm5/smartd.c b/sm5/smartd.c
index d9ddf01de..e7a8ef173 100644
--- a/sm5/smartd.c
+++ b/sm5/smartd.c
@@ -69,7 +69,7 @@
 extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *escalade_c_cvsid, 
                   *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid;
 
-const char *smartd_c_cvsid="$Id: smartd.c,v 1.265 2003/12/10 13:52:06 ballen4705 Exp $" 
+const char *smartd_c_cvsid="$Id: smartd.c,v 1.266 2003/12/10 21:59:42 ballen4705 Exp $" 
                             ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID KNOWNDRIVES_H_CVSID
                             SCSICMDS_H_CVSID SMARTD_H_CVSID UTILITY_H_CVSID; 
 
@@ -1393,7 +1393,7 @@ int DoTestNow(cfgfile *cfg, char testtype) {
     return 0;
   
   // never do a second test in the same hour as another test
-  hours=1+timenow.tm_hour+24*timenow.tm_yday;
+  hours=1+timenow.tm_hour+24*(timenow.tm_yday+366*(timenow.tm_year % 7));
   if (hours==dat->hour) {
     if (testtype!=dat->testtype)
       PrintOut(LOG_INFO, "Device: %s, did test of type %c qin current hour, skipping test of type %c\n",
diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp
index ecbd835f7..710bc568c 100644
--- a/sm5/smartd.cpp
+++ b/sm5/smartd.cpp
@@ -69,7 +69,7 @@
 extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *escalade_c_cvsid, 
                   *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid;
 
-const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.265 2003/12/10 13:52:06 ballen4705 Exp $" 
+const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.266 2003/12/10 21:59:42 ballen4705 Exp $" 
                             ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID KNOWNDRIVES_H_CVSID
                             SCSICMDS_H_CVSID SMARTD_H_CVSID UTILITY_H_CVSID; 
 
@@ -1393,7 +1393,7 @@ int DoTestNow(cfgfile *cfg, char testtype) {
     return 0;
   
   // never do a second test in the same hour as another test
-  hours=1+timenow.tm_hour+24*timenow.tm_yday;
+  hours=1+timenow.tm_hour+24*(timenow.tm_yday+366*(timenow.tm_year % 7));
   if (hours==dat->hour) {
     if (testtype!=dat->testtype)
       PrintOut(LOG_INFO, "Device: %s, did test of type %c qin current hour, skipping test of type %c\n",
-- 
GitLab