Index: RollingFileAppender.cs
===================================================================
--- RollingFileAppender.cs (revision 383163)
+++ RollingFileAppender.cs (working copy)
@@ -232,7 +232,6 @@
///
public RollingFileAppender()
{
- m_dateTime = new DefaultDateTime();
}
#endregion Public Instance Constructors
@@ -240,6 +239,17 @@
#region Public Instance Properties
///
+ /// Gets or sets the strategy for determining the current date and time. The default
+ /// strategy is to use DateTime.Now. DateTime.UtcNow may be used by specifying
+ /// .
+ ///
+ public IDateTime DateTimeStrategy
+ {
+ get { return m_dateTime; }
+ set { m_dateTime = value; }
+ }
+
+ ///
/// Gets or sets the date pattern to be used for generating file names
/// when rolling over on date.
///
@@ -1410,9 +1420,10 @@
///
/// This object supplies the current date/time. Allows test code to plug in
- /// a method to control this class when testing date/time based rolling.
+ /// a method to control this class when testing date/time based rolling. The default
+ /// implementation uses the underlying value of DateTime.Now.
///
- private IDateTime m_dateTime = null;
+ private IDateTime m_dateTime = new DefaultDateTime();
///
/// The date pattern. By default, the pattern is set to ".yyyy-MM-dd"
@@ -1542,6 +1553,26 @@
}
}
+ ///
+ /// Implementation of that returns the current time as the coordinated universal time (UTC).
+ ///
+ private class UniversalDateTime : IDateTime
+ {
+ ///
+ /// Gets the current time.
+ ///
+ /// The current time.
+ ///
+ ///
+ /// Gets the current time.
+ ///
+ ///
+ public DateTime Now
+ {
+ get { return DateTime.UtcNow; }
+ }
+ }
+
#endregion DateTime
}
}