diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs index c069730e149b437e602974f92b65004f913b4169..b633804741d959db1b2ffd44c60e7f76cb85ac99 100644 --- a/AutoTx/AutoTx.cs +++ b/AutoTx/AutoTx.cs @@ -399,8 +399,8 @@ namespace AutoTx CheckFreeDiskSpace(); UpdateServiceState(); - var delta = DateTime.Now - _lastUserDirCheck; - if (delta.Seconds >= 120) + var delta = (int)(DateTime.Now - _lastUserDirCheck).TotalSeconds; + if (delta >= 120) CreateIncomingDirectories(); // tasks depending on the service state: @@ -970,7 +970,7 @@ namespace AutoTx private Dictionary<string, List<Tuple<DirectoryInfo, long, int>>> ExpiredDirs(int thresh) { var collection = new Dictionary<string, List<Tuple<DirectoryInfo, long, int>>>(); var graceDir = new DirectoryInfo(Path.Combine(_managedPath, "DONE")); - var now = DateTime.UtcNow; + var now = DateTime.Now; foreach (var userdir in graceDir.GetDirectories()) { var expired = new List<Tuple<DirectoryInfo, long, int>>(); foreach (var subdir in userdir.GetDirectories()) { diff --git a/AutoTx/Email.cs b/AutoTx/Email.cs index c068a2b16c9a23809752f2f87910e5204a8d9169..8cee0dde33bdd32b26c47ffd3d9ac7db5d0d53e1 100644 --- a/AutoTx/Email.cs +++ b/AutoTx/Email.cs @@ -80,9 +80,12 @@ namespace AutoTx if (_config.SendAdminNotification == false) return; - var delta = DateTime.Now - _status.LastAdminNotification; - if (delta.Minutes < _config.AdminNotificationDelta) + var delta = (int)(DateTime.Now - _status.LastAdminNotification).TotalMinutes; + if (delta < _config.AdminNotificationDelta) { + writeLogDebug("Suppressed admin email, interval too short (" + delta + " vs. " + + _config.AdminNotificationDelta + "):\n\n" + subject + "\n" + body); return; + } if (subject == "") { subject = ServiceName + @@ -103,8 +106,8 @@ namespace AutoTx /// </summary> /// <param name="spaceDetails">String describing the drives being low on space.</param> public void SendLowSpaceMail(string spaceDetails) { - var delta = DateTime.Now - _status.LastStorageNotification; - if (delta.Minutes < _config.StorageNotificationDelta) + var delta = (int)(DateTime.Now - _status.LastStorageNotification).TotalMinutes; + if (delta < _config.StorageNotificationDelta) return; writeLog("WARNING: " + spaceDetails);