You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by ni...@apache.org on 2006/03/03 17:52:19 UTC
svn commit: r382884 -
/logging/log4net/trunk/src/Appender/RollingFileAppender.cs
Author: nicko
Date: Fri Mar 3 08:52:19 2006
New Revision: 382884
URL: http://svn.apache.org/viewcvs?rev=382884&view=rev
Log:
Fix for LOG4NET-60.
Fixed issue with calculation of the NextCheckDate for TopOfMonth RollPoints.
Added more descriptive docs on the NextCheckDate method.
Modified:
logging/log4net/trunk/src/Appender/RollingFileAppender.cs
Modified: logging/log4net/trunk/src/Appender/RollingFileAppender.cs
URL: http://svn.apache.org/viewcvs/logging/log4net/trunk/src/Appender/RollingFileAppender.cs?rev=382884&r1=382883&r2=382884&view=diff
==============================================================================
--- logging/log4net/trunk/src/Appender/RollingFileAppender.cs (original)
+++ logging/log4net/trunk/src/Appender/RollingFileAppender.cs Fri Mar 3 08:52:19 2006
@@ -1323,15 +1323,20 @@
#region NextCheckDate
/// <summary>
- /// Roll on to the next interval after the date passed
+ /// Get the start time of the next window for the current rollpoint
/// </summary>
/// <param name="currentDateTime">the current date</param>
/// <param name="rollPoint">the type of roll point we are working with</param>
- /// <returns>the next roll point an interval after the currentDateTime date</returns>
+ /// <returns>the start time for the next roll point an interval after the currentDateTime date</returns>
/// <remarks>
/// <para>
- /// Advances the date to the next roll point after the
- /// currentDateTime date passed to the method.
+ /// Returns the date of the next roll point after the currentDateTime date passed to the method.
+ /// </para>
+ /// <para>
+ /// The basic strategy is to subtract the time parts that are less significant
+ /// than the rollpoint from the current time. This should roll the time back to
+ /// the start of the time window for the current rollpoint. Then we add 1 window
+ /// worth of time and get the start time of the next window for the rollpoint.
/// </para>
/// </remarks>
protected DateTime NextCheckDate(DateTime currentDateTime, RollPoint rollPoint)
@@ -1339,7 +1344,7 @@
// Local variable to work on (this does not look very efficient)
DateTime current = currentDateTime;
- // Do different things depending on what the type of roll point we are going for is
+ // Do slightly different things depending on what the type of roll point we want.
switch(rollPoint)
{
case RollPoint.TopOfMinute:
@@ -1392,6 +1397,7 @@
current = current.AddSeconds(-current.Second);
current = current.AddMinutes(-current.Minute);
current = current.AddHours(-current.Hour);
+ current = current.AddDays(-current.Day);
current = current.AddMonths(1);
break;
}