lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r835444 - in /incubator/lucene.net/trunk/C#/src: Lucene.Net/Index/ Lucene.Net/Store/ Test/ Test/Analysis/ Test/Index/ Test/Search/
Date Thu, 12 Nov 2009 16:59:47 GMT
Author: digy
Date: Thu Nov 12 16:59:46 2009
New Revision: 835444

URL: http://svn.apache.org/viewvc?rev=835444&view=rev
Log:
LUCENENET-231 System.DateTime.Now.Millisecond bug  

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentInfos.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/LockVerifyServer.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMFile.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMOutputStream.cs
    incubator/lucene.net/trunk/C#/src/Test/Analysis/TestTeeSinkTokenFilter.cs
    incubator/lucene.net/trunk/C#/src/Test/Analysis/TestTeeTokenFilter.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestAtomicUpdate.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestDeletionPolicy.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestFieldsReader.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexModifier.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriter.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriterExceptions.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriterReader.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestNRTReaderWithThreads.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestStressIndexing.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestTermdocPerf.cs
    incubator/lucene.net/trunk/C#/src/Test/Index/TestTransactions.cs
    incubator/lucene.net/trunk/C#/src/Test/Search/TestDateFilter.cs
    incubator/lucene.net/trunk/C#/src/Test/Search/TestMultiThreadTermVectors.cs
    incubator/lucene.net/trunk/C#/src/Test/TestSnapshotDeletionPolicy.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentInfos.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/SegmentInfos.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentInfos.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentInfos.cs Thu Nov 12 16:59:46
2009
@@ -157,7 +157,7 @@
 		/// <summary> counts how often the index has been changed by adding or deleting docs.
 		/// starting with the current time in milliseconds forces to create unique version numbers.
 		/// </summary>
-		private long version = System.DateTime.Now.Millisecond;
+		private long version = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 		
 		private long generation = 0; // generation of the "segments_N" for the next commit
 		private long lastGeneration = 0; // generation of the "segments_N" file we last successfully
read
@@ -338,7 +338,7 @@
 				{
 					// in old format the version number may be at the end of the file
 					if (input.GetFilePointer() >= input.Length())
-						version = System.DateTime.Now.Millisecond;
+						version = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 					// old file format without version number
 					else
 						version = input.ReadLong(); // read version

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/LockVerifyServer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/LockVerifyServer.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/LockVerifyServer.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/LockVerifyServer.cs Thu Nov 12 16:59:46
2009
@@ -36,7 +36,7 @@
 		
 		private static System.String GetTime(long startTime)
 		{
-			return "[" + ((System.DateTime.Now.Millisecond - startTime) / 1000) + "s] ";
+			return "[" + (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - startTime) / 1000)
+ "s] ";
 		}
 		
 		[STAThread]
@@ -59,7 +59,7 @@
 			System.Console.Out.WriteLine("\nReady on port " + port + "...");
 			
 			int lockedID = 0;
-			long startTime = System.DateTime.Now.Millisecond;
+			long startTime = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 			
 			while (true)
 			{

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMFile.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/RAMFile.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMFile.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMFile.cs Thu Nov 12 16:59:46 2009
@@ -32,7 +32,7 @@
 		internal long sizeInBytes; // Only maintained if in a directory; updates synchronized on
directory
 		
 		// This is publicly modifiable via Directory.touchFile(), so direct access not supported
-		private long lastModified = System.DateTime.Now.Millisecond;
+		private long lastModified = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 		
 		// File used as buffer, in no RAMDirectory
 		public /*internal*/ RAMFile()

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMOutputStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Store/RAMOutputStream.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMOutputStream.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMOutputStream.cs Thu Nov 12 16:59:46
2009
@@ -171,7 +171,7 @@
 		
 		public override void  Flush()
 		{
-			file.SetLastModified(System.DateTime.Now.Millisecond);
+			file.SetLastModified((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond));
 			SetFileLength();
 		}
 		

Modified: incubator/lucene.net/trunk/C#/src/Test/Analysis/TestTeeSinkTokenFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Analysis/TestTeeSinkTokenFilter.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Analysis/TestTeeSinkTokenFilter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Analysis/TestTeeSinkTokenFilter.cs Thu Nov 12 16:59:46
2009
@@ -212,7 +212,7 @@
 				for (int j = 0; j < modCounts.Length; j++)
 				{
 					int tfPos = 0;
-					long start = System.DateTime.Now.Millisecond;
+					long start = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 					for (int i = 0; i < 20; i++)
 					{
 						stream = new StandardFilter(new StandardTokenizer(new System.IO.StringReader(buffer.ToString())));
@@ -228,11 +228,11 @@
 							tfPos += posIncrAtt.GetPositionIncrement();
 						}
 					}
-					long finish = System.DateTime.Now.Millisecond;
+					long finish = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 					System.Console.Out.WriteLine("ModCount: " + modCounts[j] + " Two fields took " + (finish
- start) + " ms");
 					int sinkPos = 0;
 					//simulate one field with one sink
-					start = System.DateTime.Now.Millisecond;
+					start = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 					for (int i = 0; i < 20; i++)
 					{
 						teeStream = new TeeSinkTokenFilter(new StandardFilter(new StandardTokenizer(new System.IO.StringReader(buffer.ToString()))));
@@ -249,7 +249,7 @@
 							sinkPos += posIncrAtt.GetPositionIncrement();
 						}
 					}
-					finish = System.DateTime.Now.Millisecond;
+					finish = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 					System.Console.Out.WriteLine("ModCount: " + modCounts[j] + " Tee fields took " + (finish
- start) + " ms");
                     Assert.IsTrue(sinkPos == tfPos, sinkPos + " does not equal: " + tfPos);
 				}

Modified: incubator/lucene.net/trunk/C#/src/Test/Analysis/TestTeeTokenFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Analysis/TestTeeTokenFilter.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Analysis/TestTeeTokenFilter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Analysis/TestTeeTokenFilter.cs Thu Nov 12 16:59:46
2009
@@ -262,7 +262,7 @@
 				for (int j = 0; j < modCounts.Length; j++)
 				{
 					int tfPos = 0;
-					long start = System.DateTime.Now.Millisecond;
+					long start = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 					for (int i = 0; i < 20; i++)
 					{
 						stream = new StandardFilter(new StandardTokenizer(new System.IO.StringReader(buffer.ToString())));
@@ -276,11 +276,11 @@
 							tfPos += nextToken.GetPositionIncrement();
 						}
 					}
-					long finish = System.DateTime.Now.Millisecond;
+					long finish = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 					System.Console.Out.WriteLine("ModCount: " + modCounts[j] + " Two fields took " + (finish
- start) + " ms");
 					int sinkPos = 0;
 					//simulate one field with one sink
-					start = System.DateTime.Now.Millisecond;
+					start = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 					for (int i = 0; i < 20; i++)
 					{
 						sink = new ModuloSinkTokenizer(this, tokCount[k], modCounts[j]);
@@ -296,7 +296,7 @@
 							sinkPos += nextToken.GetPositionIncrement();
 						}
 					}
-					finish = System.DateTime.Now.Millisecond;
+					finish = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 					System.Console.Out.WriteLine("ModCount: " + modCounts[j] + " Tee fields took " + (finish
- start) + " ms");
 					Assert.IsTrue(sinkPos == tfPos, sinkPos + " does not equal: " + tfPos);
 				}

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestAtomicUpdate.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestAtomicUpdate.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestAtomicUpdate.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestAtomicUpdate.cs Thu Nov 12 16:59:46 2009
@@ -82,20 +82,15 @@
 				this.allThreads = threads;
 			}
 
-            long Millisecond()
-            {
-                return System.DateTime.Now.Ticks / 10000;
-            }
-
             override public void Run()
             {
-                long stopTime = Millisecond() + 1000 * RUN_TIME_SEC;
+                long stopTime = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) + 1000
* RUN_TIME_SEC;
 
                 count = 0;
 
                 try
                 {
-                    while (Millisecond() < stopTime && !AnyErrors())
+                    while ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) < stopTime
&& !AnyErrors())
                     {
                         DoWork();
                         count++;

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestDeletionPolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestDeletionPolicy.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestDeletionPolicy.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestDeletionPolicy.cs Thu Nov 12 16:59:46
2009
@@ -301,7 +301,7 @@
 			{
 				// Record last time when writer performed deletes of
 				// past commits
-				lastDeleteTime = System.DateTime.Now.Millisecond;
+				lastDeleteTime = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 				writer = new IndexWriter(dir, autoCommit, new WhitespaceAnalyzer(), false, policy);
 				writer.SetUseCompoundFile(useCompoundFile);
 				for (int j = 0; j < 17; j++)

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestFieldsReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestFieldsReader.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestFieldsReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestFieldsReader.cs Thu Nov 12 16:59:46 2009
@@ -294,10 +294,10 @@
 				System.String value_Renamed;
 				long start;
 				long finish;
-				start = System.DateTime.Now.Millisecond;
+				start = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 				//On my machine this was always 0ms.
 				value_Renamed = field.StringValue();
-				finish = System.DateTime.Now.Millisecond;
+				finish = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 				Assert.IsTrue(value_Renamed != null, "value is null and it shouldn't be");
 				Assert.IsTrue(field != null, "field is null and it shouldn't be");
 				regularTime += (finish - start);
@@ -310,10 +310,10 @@
 				doc = reader.Doc(0, fieldSelector);
 				field = doc.GetFieldable(DocHelper.LARGE_LAZY_FIELD_KEY);
 				Assert.IsTrue(field.IsLazy() == true, "field is not lazy");
-				start = System.DateTime.Now.Millisecond;
+				start = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 				//On my machine this took around 50 - 70ms
 				value_Renamed = field.StringValue();
-				finish = System.DateTime.Now.Millisecond;
+				finish = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 				Assert.IsTrue(value_Renamed != null, "value is null and it shouldn't be");
 				lazyTime += (finish - start);
 				reader.Close();

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexModifier.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestIndexModifier.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexModifier.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexModifier.cs Thu Nov 12 16:59:46
2009
@@ -281,10 +281,10 @@
 		override public void  Run()
 		{
 			
-			long endTime = System.DateTime.Now.Millisecond + 1000 * TEST_SECONDS;
+			long endTime = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) + 1000 * TEST_SECONDS;
 			try
 			{
-				while (System.DateTime.Now.Millisecond < endTime)
+				while ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) < endTime)
 				{
 					int rand = random.Next(101);
 					if (rand < 5)

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestIndexWriter.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriter.cs Thu Nov 12 16:59:46 2009
@@ -2899,9 +2899,9 @@
 				
 				int idUpto = 0;
 				int fullCount = 0;
-				long stopTime = System.DateTime.Now.Millisecond + 500;
+				long stopTime = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) + 500;
 				
-				while (System.DateTime.Now.Millisecond < stopTime)
+				while ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) < stopTime)
 				{
 					try
 					{

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriterExceptions.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestIndexWriterExceptions.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriterExceptions.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriterExceptions.cs Thu Nov 12 16:59:46
2009
@@ -83,9 +83,9 @@
 				Field idField = new Field("id", "", Field.Store.YES, Field.Index.NOT_ANALYZED);
 				doc.Add(idField);
 				
-				long stopTime = System.DateTime.Now.Millisecond + 3000;
+				long stopTime = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) + 3000;
 				
-				while (System.DateTime.Now.Millisecond < stopTime)
+				while ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) < stopTime)
 				{
 					System.Threading.Thread.SetData(Enclosing_Instance.doFail, this);
 					System.String id = "" + r.Next(50);

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriterReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestIndexWriterReader.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriterReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriterReader.cs Thu Nov 12 16:59:46
2009
@@ -69,7 +69,7 @@
 			}
 			override public void  Run()
 			{
-				while (System.DateTime.Now.Millisecond < endTime)
+				while ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) < endTime)
 				{
 					try
 					{
@@ -112,7 +112,7 @@
 			{
 				int count = 0;
 				System.Random r = new System.Random();
-				while (System.DateTime.Now.Millisecond < endTime)
+				while ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) < endTime)
 				{
 					try
 					{
@@ -936,7 +936,7 @@
 			int NUM_THREAD = 5;
 			float SECONDS = 3;
 			
-			long endTime = (long) (System.DateTime.Now.Millisecond + 1000.0 * SECONDS);
+			long endTime = (long) ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) + 1000.0 *
SECONDS);
 			System.Collections.IList excs = (System.Collections.IList) System.Collections.ArrayList.Synchronized(new
System.Collections.ArrayList(new System.Collections.ArrayList()));
 			
 			SupportClass.ThreadClass[] threads = new SupportClass.ThreadClass[NUM_THREAD];
@@ -948,7 +948,7 @@
 			}
 			
 			int lastCount = 0;
-			while (System.DateTime.Now.Millisecond < endTime)
+			while ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) < endTime)
 			{
 				IndexReader r2 = r.Reopen();
 				if (r2 != r)
@@ -993,7 +993,7 @@
 			int NUM_THREAD = 5;
 			float SECONDS = 3;
 			
-			long endTime = (long) (System.DateTime.Now.Millisecond + 1000.0 * SECONDS);
+			long endTime = (long) ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) + 1000.0 *
SECONDS);
 			System.Collections.IList excs = (System.Collections.IList) System.Collections.ArrayList.Synchronized(new
System.Collections.ArrayList(new System.Collections.ArrayList()));
 			
 			SupportClass.ThreadClass[] threads = new SupportClass.ThreadClass[NUM_THREAD];
@@ -1005,7 +1005,7 @@
 			}
 			
 			int sum = 0;
-			while (System.DateTime.Now.Millisecond < endTime)
+			while ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) < endTime)
 			{
 				IndexReader r2 = r.Reopen();
 				if (r2 != r)

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestNRTReaderWithThreads.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestNRTReaderWithThreads.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestNRTReaderWithThreads.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestNRTReaderWithThreads.cs Thu Nov 12 16:59:46
2009
@@ -52,9 +52,9 @@
 				indexThreads[x].Name = "Thread " + x;
 				indexThreads[x].Start();
 			}
-			long startTime = System.DateTime.Now.Millisecond;
+			long startTime = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 			long duration = 5 * 1000;
-			while ((System.DateTime.Now.Millisecond - startTime) < duration)
+			while (((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - startTime) < duration)
 			{
 				System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 100));
 			}

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestStressIndexing.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestStressIndexing.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestStressIndexing.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestStressIndexing.cs Thu Nov 12 16:59:46
2009
@@ -54,13 +54,13 @@
 			
 			override public void  Run()
 			{
-				long stopTime = System.DateTime.Now.Millisecond + 1000 * RUN_TIME_SEC;
+				long stopTime = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) + 1000 * RUN_TIME_SEC;
 				
 				count = 0;
 				
 				try
 				{
-					while (System.DateTime.Now.Millisecond < stopTime && !AnyErrors())
+					while ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) < stopTime &&
!AnyErrors())
 					{
 						DoWork();
 						count++;

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestTermdocPerf.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestTermdocPerf.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestTermdocPerf.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestTermdocPerf.cs Thu Nov 12 16:59:46 2009
@@ -126,16 +126,16 @@
 		{
 			Directory dir = new RAMDirectory();
 			
-			long start = System.DateTime.Now.Millisecond;
+			long start = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 			AddDocs(dir, ndocs, "foo", "val", maxTF, percentDocs);
-			long end = System.DateTime.Now.Millisecond;
+			long end = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 			System.Console.Out.WriteLine("milliseconds for creation of " + ndocs + " docs = " + (end
- start));
 			
 			IndexReader reader = IndexReader.Open(dir);
 			TermEnum tenum = reader.Terms(new Term("foo", "val"));
 			TermDocs tdocs = reader.TermDocs();
 			
-			start = System.DateTime.Now.Millisecond;
+			start = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 			
 			int ret = 0;
 			for (int i = 0; i < iter; i++)
@@ -147,7 +147,7 @@
 				}
 			}
 			
-			end = System.DateTime.Now.Millisecond;
+			end = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 			System.Console.Out.WriteLine("milliseconds for " + iter + " TermDocs iteration: " + (end
- start));
 			
 			return ret;

Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestTransactions.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestTransactions.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestTransactions.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestTransactions.cs Thu Nov 12 16:59:46 2009
@@ -76,11 +76,11 @@
 			
 			override public void  Run()
 			{
-				long stopTime = System.DateTime.Now.Millisecond + 1000 * RUN_TIME_SEC;
+				long stopTime = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) + 1000 * RUN_TIME_SEC;
 				
 				try
 				{
-					while (System.DateTime.Now.Millisecond < stopTime && !AnyErrors())
+					while ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) < stopTime &&
!AnyErrors())
 						DoWork();
 				}
 				catch (System.Exception e)

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestDateFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestDateFilter.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestDateFilter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestDateFilter.cs Thu Nov 12 16:59:46 2009
@@ -52,7 +52,7 @@
 			RAMDirectory indexStore = new RAMDirectory();
 			IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
 			
-			long now = System.DateTime.Now.Millisecond;
+			long now = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 			
 			Document doc = new Document();
 			// add time that is in the past
@@ -109,7 +109,7 @@
 			RAMDirectory indexStore = new RAMDirectory();
 			IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
 			
-			long now = System.DateTime.Now.Millisecond;
+			long now = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 			
 			Document doc = new Document();
 			// add time that is in the future

Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestMultiThreadTermVectors.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestMultiThreadTermVectors.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestMultiThreadTermVectors.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestMultiThreadTermVectors.cs Thu Nov 12
16:59:46 2009
@@ -184,16 +184,16 @@
 			long start = 0L;
 			for (int docId = 0; docId < numDocs; docId++)
 			{
-				start = System.DateTime.Now.Millisecond;
+				start = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 				TermFreqVector[] vectors = reader.GetTermFreqVectors(docId);
-				timeElapsed += System.DateTime.Now.Millisecond - start;
+				timeElapsed += (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - start;
 				
 				// verify vectors result
 				VerifyVectors(vectors, docId);
 				
-				start = System.DateTime.Now.Millisecond;
+				start = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 				TermFreqVector vector = reader.GetTermFreqVector(docId, "field");
-				timeElapsed += System.DateTime.Now.Millisecond - start;
+				timeElapsed += (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) - start;
 				
 				vectors = new TermFreqVector[1];
 				vectors[0] = vector;

Modified: incubator/lucene.net/trunk/C#/src/Test/TestSnapshotDeletionPolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/TestSnapshotDeletionPolicy.cs?rev=835444&r1=835443&r2=835444&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/TestSnapshotDeletionPolicy.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/TestSnapshotDeletionPolicy.cs Thu Nov 12 16:59:46
2009
@@ -75,7 +75,7 @@
 			{
 				Document doc = new Document();
 				doc.Add(new Field("content", "aaa", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
-				while (System.DateTime.Now.Millisecond < stopTime)
+				while ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) < stopTime)
 				{
 					for (int i = 0; i < 27; i++)
 					{
@@ -168,7 +168,7 @@
 		private void  RunTest(Directory dir)
 		{
 			// Run for ~7 seconds
-			long stopTime = System.DateTime.Now.Millisecond + 7000;
+			long stopTime = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) + 7000;
 			
 			SnapshotDeletionPolicy dp = new SnapshotDeletionPolicy(new KeepOnlyLastCommitDeletionPolicy());
 			IndexWriter writer = new IndexWriter(dir, true, new StandardAnalyzer(), dp);
@@ -182,7 +182,7 @@
 			
 			// While the above indexing thread is running, take many
 			// backups:
-			while (System.DateTime.Now.Millisecond < stopTime)
+			while ((DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) < stopTime)
 			{
 				BackupIndex(dir, dp);
 				System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 20));



Mime
View raw message