diff --git a/sm5/NEWS b/sm5/NEWS
index 3278fc431928d8cf3839376486055dedf58e7f96..9e87c915b17f33c5bdbd44a5b10ac427126130b8 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 d9ddf01deb9892001077621fc722a544e30650e6..e7a8ef173f413438046702808b240f9e7ae906c5 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 ecbd835f7ae18da1951dfe0c85345dba732b5422..710bc568c1a1786d3b2607aca5bbf0a50f389045 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",