English 中文(简体)
Occasional Annual or timezone differences in hudson or maven with jodatime
原标题:Occasional Date or timezone discrepancy in hudson or maven with jodatime

我希望,在作解释之后,会变得有意义,因为它是一个我们重新面临的、难以描述的棘手问题。

我们有一个马文项目,在胡德森建树,其中包括一些使用和声称日期的单位测试。 胡德森服务器在太阳能上运行。 现在,使用日期的单位测试有时(相当于30%)失败,因为从单位测试的指定时间中扣除了3.5小时,因此声称开始失败。 另有70%的人都做了罚款,尽管在法典中没有任何变化,而且我们每小时有一次工作。

我在检查时间的单位测试中添加以下代码:

@Test
public void testDate() {
    System.out.println("new DateMidnight(2011, 1, 5).toDate();");
    System.out.println(new DateMidnight(2011, 1, 5).toDate());
    System.out.println(new DateMidnight(2011, 1, 5).toDate().getTime());

    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.YEAR, 2011);
    cal.set(Calendar.MONTH, 0);
    cal.set(Calendar.DAY_OF_MONTH, 5);
    cal.set(Calendar.HOUR, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    System.out.println("cal.getTime();");
    System.out.println(cal.getTime());
    System.out.println(cal.getTime().getTime());
}

So basically it should print the same thing when using jodatime or plain old Calendar. This is the case in 70% of the runs; for the other 30% I get following printouts:

Running TestSuite
new DateMidnight(2011, 1, 5).toDate();
Tue Jan 04 21:30:00 MET 2011
1294173000000
cal.getTime();
Wed Jan 05 12:00:00 MET 2011
1294225200000

因此,日历保留正确的日期和时间,但在职时间为3 5小时。

当地ma子检验从来都不构成这一问题,我们可以说明其原因。 尤其是,我们不得不想出一种理由,即这些测试有时会通过,有时会失败,而没有改变任何法规,也没有改变son或服务器设置。

而且,我们用 co子操作了ven子,这意味着单位试验两次。 发生这种情况的还有,他们第一次走过路,第二次倒闭,或者两次失败。

Thanks for any solutions or tips to track down the cause,
Stijn

最佳回答

这个问题现在似乎已经确定。

We ve upgraded our jodatime version from 5.14.2 to 5.14.6. Since then I ran the build on auto each half hour so after about a 100 runs we never encountered this problem again.

问题回答

也可进入SUREFIRE-533的版本。 如果能做到这一点,请就此问题提出报告。

Perhaps Hudson is running on 3 servers, and 1 has a different version of the time zone data in the JDK from the other 2? (check the JVM version in detail). Remember that Joda-Time also has its own version of the time-zone data, and the two may be different.





相关问题
Weird Time Issue in Python

Problem with using times in Python. Terminal > Python >>> calendar.timegm(datetime.datetime.now().utctimetuple()) 1258449380 This time indicates GMT: Tue, 17 Nov 2009 09:16:20 GMT Eclipse ...

How does a .NET process get the culture information?

I have a Windows service running (C#, .NET 2.0) on Windows Server 2003 R2. In one server the System.Threading.Thread.CurrentThread.CurrentCulture is {en-AU} and in the other {en-US}. This has caused a ...

Best way to get maximum Date value in java?

I m writing a bit of logic that requires treating null dates as meaning forever in the future (the date in question is an expiration date, which may or may not exist). Instead of putting in special ...

Date format in SQL Server

Short Question: What s the best date format to use in SQL Server? Long Explanation: We re converting our database from mysql to SQL Server. In mysql we always used int(11) to avoid the daylight ...

Converting asp.net/sql web app to be ime zone savy

Our current app stores all dates via the server s datetime. I m thinking we need to update all datetime values in the database over to UTC time. Now for displaying these dates back to the user, I ...

Check if string is of SortableDateTimePattern format

Is there any way I can easily check if a string conforms to the SortableDateTimePattern ("s"), or do I need to write a regular expression? I ve got a form where users can input a copyright date (as a ...

DateTime in PropertyGrid in .Net

I m currently working on some DateTime properties in a PropertyGrid in c#.Net. Im using the default drop-down datetime picker. My question: Is there any way to show the full date with the time? By ...

热门标签