lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [03/11] lucenenet git commit: SWEEP: Added TimeZoneInfo.ConvertTime() to corresponding locations where time zone had been set in Lucene.
Date Fri, 22 Sep 2017 05:55:26 GMT
SWEEP: Added TimeZoneInfo.ConvertTime() to corresponding locations where time zone had been
set in Lucene.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/9c66bd18
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/9c66bd18
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/9c66bd18

Branch: refs/heads/master
Commit: 9c66bd185bda096c4b3ee0c15daedfe946049672
Parents: fe8add7
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Tue Sep 19 21:55:00 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Fri Sep 22 03:06:03 2017 +0700

----------------------------------------------------------------------
 .../Util/TestRuleSetupAndRestoreClassEnv.cs                     | 2 --
 src/Lucene.Net.Tests.Queries/ChainedFilterTest.cs               | 3 ++-
 .../Flexible/Standard/TestQPHelper.cs                           | 5 +++--
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9c66bd18/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
index 4f6d36e..08e9fc8 100644
--- a/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestRuleSetupAndRestoreClassEnv.cs
@@ -269,8 +269,6 @@ namespace Lucene.Net.Util
             timeZone = testTimeZone.Equals("random", StringComparison.Ordinal) ? randomTimeZone
: TimeZoneInfo.FindSystemTimeZoneById(testTimeZone);
             //TimeZone.Default = TimeZone; // LUCENENET NOTE: There doesn't seem to be an
equivalent to this, but I don't think we need it.
 
-            //TimeZoneInfo.ConvertTime() // LUCENENET TODO: Everywhere TimeZoneInfo is supposed
to be used, use this method to convert a dateTime object to the time zone
-
             similarity = random.NextBoolean() ? (Similarity)new DefaultSimilarity() : new
RandomSimilarityProvider(random);
 
             // Check codec restrictions once at class level.

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9c66bd18/src/Lucene.Net.Tests.Queries/ChainedFilterTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Queries/ChainedFilterTest.cs b/src/Lucene.Net.Tests.Queries/ChainedFilterTest.cs
index 914b3e0..7cb1a89 100644
--- a/src/Lucene.Net.Tests.Queries/ChainedFilterTest.cs
+++ b/src/Lucene.Net.Tests.Queries/ChainedFilterTest.cs
@@ -51,7 +51,8 @@ namespace Lucene.Net.Tests.Queries
             directory = NewDirectory();
             RandomIndexWriter writer = new RandomIndexWriter(Random(), directory, Similarity,
TimeZone);
             // we use the default Locale/TZ since LuceneTestCase randomizes it
-            var cal = new GregorianCalendar().ToDateTime(1970, 1, 1, 0, 0, 0, (int)TestUtil.NextLong(Random(),
0, long.MaxValue));
+            var cal = new GregorianCalendar().ToDateTime(2003, 1, 1, 0, 0, 0, 0); // 2003
January 01
+            cal = TimeZoneInfo.ConvertTime(cal, TimeZoneInfo.Local);
 
             for (int i = 0; i < Max; i++)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/9c66bd18/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
index 8f48fc5..3fb4953 100644
--- a/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
+++ b/src/Lucene.Net.Tests.QueryParser/Flexible/Standard/TestQPHelper.cs
@@ -764,8 +764,9 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard
 
         private String GetLocalizedDate(int year, int month, int day)
         {
-            DateTime d = new DateTime(year, month, day, 23, 59, 59, 999);
-            return d.ToString("d"); //.ToShortDateString();
+            DateTime date = new GregorianCalendar().ToDateTime(year, month, day, 23, 59,
59, 999);
+            date = TimeZoneInfo.ConvertTime(date, TimeZoneInfo.Local);
+            return date.ToString("d"); //.ToShortDateString();
 
             //// we use the default Locale/TZ since LuceneTestCase randomizes it
             //DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault());


Mime
View raw message