Prev: Basic JUnit questions
Next: Discount CHLOE True leather AAA Wholesale (www.supertradeonline06.com )
From: Lew on 20 Mar 2010 00:45 Rhino wrote: >>>> I'm just retesting some date/time methods I wrote a while back and >>>> noticed something odd. It's 8 PM Eastern time as I write this and the >>>> date routines I have just retested tell me that it's actually 9 PM. >>>> Why would that be? >>>> >>>> I'm guessing it has something to do with Java date routines not >>>> correctly handling the earlier changeover to daylight savings time >>>> that started a few years back. If that's right, how should I be >>>> calculating the hour or the time? >>>> >>>> Or have I got something wrong in my computer somewhere? I'm running >>>> XP and the system clock says it's 8 PM Eastern time and it is set to >>>> recognize Daylight Saving Time. But I may not have installed the >>>> update that handles the earlier changeover to Daylight Time. Perhaps >>>> that needs to be installed?? >>>> ... >>>> I'm running Java 1.6.18, which is pretty recent if I'm not mistaken ;-) Arne Vajhøj wrote: > It is latest, so it should have the correct timezone definitions. > > Something is confusing Java on your PC. Or something is confusing Windows or the PC itself. What does the OS claim the time zone is, independently of Java? Do the OS time and BIOS time match? Would the OP provide an SSCCE and copy-paste actual output, and a comparison with what was expected? The problem has to be in a detail that hasn't reached Usenet yet. For example, what is this 'StringUtils'? If 'String' formatted representations are needed of a 'Calendar', what's wrong with using 'DateFormat'? I really, really don't think that "it has something to do with Java date routines not correctly handling the earlier changeover to daylight savings time" or anything else to do with the standard API, nor do I think it's a problem with out-of-date tzdata. I'm deeply suspicious of code that uses a 'Calendar', then extracts fields from it, then pads the fields back into 'String's. That's an awful lot of custom conversion, with lots of room for things to be done wrong, for one to go around calumnizing the java.* packages. Look to thine own house first. -- Lew
From: Roedy Green on 20 Mar 2010 08:05 On Fri, 19 Mar 2010 19:38:27 +0000 (UTC), Rhino <no.offline.contact.please(a)example.com> wrote, quoted or indirectly quoted someone who said : >How do I get the Java routines to get the right time WHILE STILL HAVING >WINDOWS ITSELF DISPLAY THE CORRECT TIME? Click the clock time in the bottom right. click change date and time settings. Click change time zone. Make sure you have the correct timezone. Click "adjust clock for daylight saving". Rerun Setclock. -- Roedy Green Canadian Mind Products http://mindprod.com Responsible Development is the style of development I aspire to now. It can be summarized by answering the question, �How would I develop if it were my money?� I�m amazed how many theoretical arguments evaporate when faced with this question. ~ Kent Beck (born: 1961 age: 49) , evangelist for extreme programming.
From: Arved Sandstrom on 20 Mar 2010 09:21 Lew wrote: > Rhino wrote: >>>>> I'm just retesting some date/time methods I wrote a while back and >>>>> noticed something odd. It's 8 PM Eastern time as I write this and the >>>>> date routines I have just retested tell me that it's actually 9 PM. >>>>> Why would that be? >>>>> >>>>> I'm guessing it has something to do with Java date routines not >>>>> correctly handling the earlier changeover to daylight savings time >>>>> that started a few years back. If that's right, how should I be >>>>> calculating the hour or the time? >>>>> >>>>> Or have I got something wrong in my computer somewhere? I'm running >>>>> XP and the system clock says it's 8 PM Eastern time and it is set to >>>>> recognize Daylight Saving Time. But I may not have installed the >>>>> update that handles the earlier changeover to Daylight Time. Perhaps >>>>> that needs to be installed?? >>>>> ... >>>>> I'm running Java 1.6.18, which is pretty recent if I'm not mistaken >>>>> ;-) > > Arne Vajhøj wrote: >> It is latest, so it should have the correct timezone definitions. >> >> Something is confusing Java on your PC. > > Or something is confusing Windows or the PC itself. > > What does the OS claim the time zone is, independently of Java? > > Do the OS time and BIOS time match? > > Would the OP provide an SSCCE and copy-paste actual output, and a > comparison with what was expected? > > The problem has to be in a detail that hasn't reached Usenet yet. > > For example, what is this 'StringUtils'? If 'String' formatted > representations are needed of a 'Calendar', what's wrong with using > 'DateFormat'? [ SNIP ] Rhino mentioned a StringUtils class of his own - it was the subject of the "Design question" thread dating from 15 March. Although there are dozens of StringUtils classes put out by various projects, the most notable probably being Apache Commons Lang, I'm guessing the one here is likely Rhino's. The first thing I'm usually suspicious of when a test reports a test failure is the test itself. As part of one maintenance project back in 2008 I spent the best part of a month fixing defects in a JUnit test suite; nearly a hundred JUnit tests were themselves broken. They hadn't necessarily always been - most of them were OK when written - but they failed to track code changes. But some had clearly always been wrong. I think it's a bit crazy to unit test your unit tests, under normal conditions; nevertheless it's worth keeping in mind that if you can't keep your tested code error-free then neither can you keep your testing code error-free, and interpret the output of tests accordingly. In that project I mentioned, the tests that had the highest problem percentage involved date/time code. No surprise there. Both the date/time code under test, and the date/time code *in* the tests, were riddled with defects. Under the circumstances, in this hypothetical SSCCE, I'd be checking the tests first. AHS
From: Lew on 20 Mar 2010 10:19 Lew wrote: >> For example, what is this 'StringUtils'? If 'String' formatted >> representations are needed of a 'Calendar', what's wrong with using >> 'DateFormat'? Arved Sandstrom wrote: > Rhino mentioned a StringUtils class of his own - it was the subject of > the "Design question" thread dating from 15 March. Although there are > dozens of StringUtils classes put out by various projects, the most > notable probably being Apache Commons Lang, I'm guessing the one here is > likely Rhino's. Same here, but that doesn't answer my question. I mean "what is?" as in "show us the code", as it is at the time of the bug under discussion. That has not been shown. > The first thing I'm usually suspicious of when a test reports a test > failure is the test itself. As part of one maintenance project back in > 2008 I spent the best part of a month fixing defects in a JUnit test > suite; nearly a hundred JUnit tests were themselves broken. They hadn't > necessarily always been - most of them were OK when written - but they > failed to track code changes. But some had clearly always been wrong. I've seen this, too, coincidentally in one case where it was calendar functions under test and the bug in the unit test permitted wrong code to go into production. > I think it's a bit crazy to unit test your unit tests, under normal > conditions; nevertheless it's worth keeping in mind that if you can't > keep your tested code error-free then neither can you keep your testing > code error-free, and interpret the output of tests accordingly. > > In that project I mentioned, the tests that had the highest problem > percentage involved date/time code. No surprise there. Both the > date/time code under test, and the date/time code *in* the tests, were > riddled with defects. > > Under the circumstances, in this hypothetical SSCCE, I'd be checking the > tests first. The problem is that the SSCCE is hypothetical. Rhino, we need an SSCCE to proceed further. -- Lew
From: Lew on 20 Mar 2010 10:20
Rhino said : >> How do I get the Java routines to get the right time WHILE STILL HAVING >> WINDOWS ITSELF DISPLAY THE CORRECT TIME? Provide an SSCCE! -- Lew |