Merge pull request #350 from robwilkens/bug1089
[mono.git] / mcs / class / System.Configuration / System.Configuration / PositiveTimeSpanValidator.cs
index ac0a4ce97afabec52dd48823fa296f731c1a1e8e..e5abf997743b9e624f85f05b5f9568cddb744640 100644 (file)
@@ -2,7 +2,7 @@
 // System.Configuration.PositiveTimeSpanValidator.cs
 //
 // Authors:
-//  Lluis Sanchez Gual (lluis@novell.com)
+//  Chris Toshok (toshok@ximian.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 //
 
 #if NET_2_0
+using System;
 
 namespace System.Configuration
 {
        public class PositiveTimeSpanValidator: ConfigurationValidatorBase
        {
-               public override bool CanValidate (Type t)
+               public PositiveTimeSpanValidator ()
                {
-                       return t == typeof(TimeSpan);
-               }
+               }               
                
+               public override bool CanValidate (Type type)
+               {
+                       return type == typeof(TimeSpan);
+               }
+
                public override void Validate (object value)
                {
-                       if (((TimeSpan)value).Ticks <= 0)
-                               throw new ConfigurationErrorsException ("TimeSpan value must be positive.");
+                       TimeSpan s = (TimeSpan) value;
+                       if (s <= new TimeSpan (0))
+                               throw new ArgumentException ("The time span value must be positive");
                }
        }
 }
+
 #endif