Author: bodewig
Date: Fri Sep 16 09:35:33 2011
New Revision: 1171473

URL: http://svn.apache.org/viewvc?rev=1171473&view=rev
Log:
File.GetLastWriteTimeUtc is .NET 1.1+

Modified:
    logging/log4net/trunk/src/Appender/RollingFileAppender.cs

Modified: logging/log4net/trunk/src/Appender/RollingFileAppender.cs
URL: 
http://svn.apache.org/viewvc/logging/log4net/trunk/src/Appender/RollingFileAppender.cs?rev=1171473&r1=1171472&r2=1171473&view=diff
==============================================================================
--- logging/log4net/trunk/src/Appender/RollingFileAppender.cs (original)
+++ logging/log4net/trunk/src/Appender/RollingFileAppender.cs Fri Sep 16 
09:35:33 2011
@@ -242,7 +242,7 @@ namespace log4net.Appender
                /// <summary>
                /// Gets or sets the strategy for determining the current date 
and time. The default
                /// implementation is to use LocalDateTime which internally 
calls through to DateTime.Now. 
-               /// DateTime.UtcNow may be used by specifying
+               /// DateTime.UtcNow may be used on frameworks newer than .NET 
1.0 by specifying
                /// <see cref="RollingFileAppender.UniversalDateTime"/>.
                /// </summary>
                /// <value>
@@ -778,15 +778,19 @@ namespace log4net.Appender
                                        DateTime last;
                                        using(SecurityContext.Impersonate(this))
                                        {
+#if !NET_1_0
                                                if (DateTimeStrategy is 
UniversalDateTime)
                                                {
                                                        last = 
System.IO.File.GetLastWriteTimeUtc(m_baseFileName);
                                                }
                                                else
                                                {
+#endif
                                                        last = 
System.IO.File.GetLastWriteTime(m_baseFileName);
+#if !NET_1_0
                                                }
-                                       }
+#endif
+                    }
                                        LogLog.Debug(declaringType, 
"["+last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo)+"]
 vs. 
["+m_now.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo)+"]");
 
                                        if 
(!(last.ToString(m_datePattern,System.Globalization.DateTimeFormatInfo.InvariantInfo).Equals(m_now.ToString(m_datePattern,
 System.Globalization.DateTimeFormatInfo.InvariantInfo)))) 
@@ -1674,6 +1678,7 @@ namespace log4net.Appender
                        }
                }
 
+#if !NET_1_0
                /// <summary>
                /// Implementation of <see cref="IDateTime"/> that returns the 
current time as the coordinated universal time (UTC).
                /// </summary>
@@ -1693,7 +1698,8 @@ namespace log4net.Appender
                                get { return DateTime.UtcNow; }
                        }
                }
+#endif
 
-               #endregion DateTime
+        #endregion DateTime
        }
 }


Reply via email to