From: Martin Gregorie on
On Sat, 20 Mar 2010 20:46:09 +0000, Rhino wrote:

> Actually, I'm NOT trying to blame Roedy's SetClock, I'm trying to
> understand the behaviour I am getting. If the problem is in Windows,
> that's fine, I'm quite prepared to accept that. For the moment, I'm just
> trying to be sure that I'm following Roedy's instructions correctly. The
> first point of failure with this kind of thing is usually communications
> issues over understanding the instructions, at least in my case.
>
Which XP service pack are you using? Details are here:

http://www.windowskb.com/Uwe/Forum.aspx/windowsxp/264794/Windows-XP-SP3-
handles-Daylight-Savings-Time-end-incorrectly

How does Your copy of Windows use its RTC? Older Windowses used to insist
on setting the RTC to the local time and dealing with daylight savings
time by resetting the clock at the start and end of DST. Software running
on those versions must not attempt to correct for DST: timezone and
daylight savings offsets are purely documentary on those Windows
versions. They are only relevant to time calculations when the RTC is set
to UTC.

IIRC Windows 7 sets its RTC to UTC and applies timezone and DST offsets
to it when the time is requested. This means the following questions need
answers:

- how does your copy of Windows handle the RTC?

- do Windows Java implementations detect which version they are
running on and use this to determine whether the clock is on local
time or RTC?


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
From: Lew on
Eric Sosman wrote:
>> 5) Refrain from calling non-final instance methods on objects
>> that haven't finished construction! This is a Big No-No;

Rhino wrote:
> With regards to your fifth point, I'm afraid I still get a little
> muddled when someone makes a generalized commment like that without
> also pointing to the specific thing I've done wrong. Can you clarify
> which object hasn't finished construction?

'TestHour'.

You call a bunch of methods from inside the constructor, ergo the object
hasn't finished construction when you call methods like
'getCurrentHour12HourClock()'. It is better (usually) to let an object finish
construction before it does anything useful.

(TAB characters removed for readability.)
> public TestHour() {
>
> System.out.println("The current hour on the 12 hour clock is: " +
> getCurrentHour12HourClock() + ".\n");
> System.out.println("The current hour on the 24 hour clock is: " +
> getCurrentHour24HourClock() + ".\n");
> System.out.println("The current time is: " + getCurrentTime() + ".
> \n");
> }

And please, please, please, please, please use narrower indentation for Usenet
code posts - a maximum of four spaces per indent level. It makes the code so
hard to read when you use such wide indentation. Stop using TAB characters
for indentation.

> The output wraps horribly so I'll just summarize it verbally:
> The hour still shows as 7 PM even though it was not yet 7 PM
> when I executed the code.

The actual output still has a marginal chance of being useful to those of us
not there who attempt to help from here. Every time you redact information
you risk losing the piece that solves the puzzle.

--
Lew
From: Arved Sandstrom on
Rhino wrote:
[ SNIP ]

> If you'd like to see the JUnit tests, I could include them but I'm pretty
> sure that there is nothing wrong with them.

It can't hurt - you've asked for feedback concerning testing in general,
and JUnit specifically, and that's a good way to get some.

AHS
From: Arved Sandstrom on
Rhino wrote:
[ SNIP ]

> Therefore, it seems to me that each method should be standalone and
> not count on the caller having executed other methods first, aside
> from the getInstance() of course.
[ SNIP ]

This is not functional programming so whether methods are standalone or
not is entirely your business. OOP is loaded with examples of methods
requiring other methods to execute first. You should be clear in your
own mind as to what methods behave like pure functions and which don't,
however.

AHS
From: Rhino on
On Mar 20, 6:21 pm, Martin Gregorie <mar...(a)address-in-sig.invalid>
wrote:
> On Sat, 20 Mar 2010 20:46:09 +0000, Rhino wrote:
> > Actually, I'm NOT trying to blame Roedy's SetClock, I'm trying to
> > understand the behaviour I am getting. If the problem is in Windows,
> > that's fine, I'm quite prepared to accept that. For the moment, I'm just
> > trying to be sure that I'm following Roedy's instructions correctly. The
> > first point of failure with this kind of thing is usually communications
> > issues over understanding the instructions, at least in my case.
>
> Which XP service pack are you using? Details are here:
>
> http://www.windowskb.com/Uwe/Forum.aspx/windowsxp/264794/Windows-XP-SP3-
> handles-Daylight-Savings-Time-end-incorrectly
>
> How does Your copy of Windows use its RTC? Older Windowses used to insist
> on setting the RTC to the local time and dealing with daylight savings
> time by resetting the clock at the start and end of DST. Software running
> on those versions must not attempt to correct for DST: timezone and
> daylight savings offsets are purely documentary on those Windows
> versions. They are only relevant to time calculations when the RTC is set
> to UTC.
>
> IIRC Windows 7 sets its RTC to UTC and applies timezone and DST offsets
> to it when the time is requested. This means the following questions need
> answers:
>
> - how does your copy of Windows handle the RTC?
>
> - do Windows Java implementations detect which version they are
>   running on and use this to determine whether the clock is on local
>   time or RTC?
>
> --
> martin@   | Martin Gregorie
> gregorie. | Essex, UK
> org       |

I'm running XP SP2, not SP3. I asked about DST issue on one of the
Microsoft newsgroups and they pointed me to a web page which is
supposed to help me install whatever I need. I went to that page, and
had to identify my skill level; I chose programmer and it started
blathering about C# and .NET but I don't develop in those. So I re-
selected the skill level to home user. It asked me which program I was
updating; I chose Outlook 2007 but it failed to execute with a cryptic
error message.

Frankly, I suspect the OS very strongly here but am baffled about what
I need to do to fix this issue.

If you can enlighten me, I'd appreciate it.

--
Rhino