Any suggestions would be much appreciated.
Ok, I have found that it is not a cpu problem as I have another box with an AMD Duron XP 1000MHz(5x200) which runs at the correct speed.
I have tried it on another computer (an intel celeron 4A, 2400MHz(6x400) and it runs slow. ) There doesn't seem to be any link between the CPU and the slow clock problem.
I thought now maybe it could be a video card problem, but can't see any problems out there of this kind.
Does anyone have any other ideas on what might be causing my analog clock program to run slow on one box and not another
cheers
James
I have tried it on another computer (an intel celeron 4A, 2400MHz(6x400) and it runs slow. ) There doesn't seem to be any link between the CPU and the slow clock problem.
I thought now maybe it could be a video card problem, but can't see any problems out there of this kind.
Does anyone have any other ideas on what might be causing my analog clock program to run slow on one box and not another
cheers
James

C# analog clock runs slow on some computers
SamuelNguyen
When you say it "runs slow", I imagine that it isn't that it doesn't show the correct time, just that it seems to update a bit slower than other machines. If that's the case, and you really want to investigate things at a lower level:
a) examine the hardware that is installed on the comparable machines;
b) examine the drivers used for that hardware installed on those machines; and
c) examine if the same motherboard is used for a particular machine.
Perhaps there is a driver that's spending a good bit of time in an interrupt handler somewhere either out of necessity or perhaps less than optimal design. Also, there may be hardware requesting a bit more interrupts than it requires. Not all hardware/drivers are created equal (nor how the motherboard itself relays the hardware to the CPU).
I may be way off base with my suggestion that it may be a low-level driver/hardware issue, but it does seem delay can be introduced at a level that isn't necessarily apparent to the OS (aside from drivers). I've seen early motherboards designed for a multiprocessor system actually run applications much slower than the single CPU motherboard.
Regards,
Joe
James V
As you said the Threading.Timer is used to get an interval.
private void TimerOnTick(object obj) { this.Time = DateTime.Now; //this.Time is a DateTime method within the class that does the graphics.
}
public void startStopTime(bool sst) { if(sst){ // Create the delegate that invokes methods for the timer.TimerCallback timerDelegate =
new TimerCallback(TimerOnTick);clkReady =
true;clkTick = 0;
this.timer1 = new System.Threading.Timer(new TimerCallback(timerDelegate), null, 0, this.ClockSpeed);}
else { if(this.timer1 != null){ this.timer1.Change(System.Threading.Timeout.Infinite,System.Threading.Timeout.Infinite);
}
clkReady =
false;}
}

There is more, but I do not want to get into the details as this code has been checked out by Microsoft. And I am fairly sure the problem is not in the code but rather the environment.
Any other hints
GT_MSDN
oops!!..sorry about my outbust of steam in my last posting. It was a late night.
Thanks Joe for posting. It's great to get some response.
I thought it might be hardware, but the computers I have tested vary as follows:
This is the email I sent to Microsoft.
----------------------------------------------------------------------------
Dear Engineer,
Case Number:
I have a problem with the System.Threading.Timer class (at least I think it might be this class) that I am using for my C#.NET analog clock program. The clock runs faster on some boxes than it does on others ie Intel box or AMD box.
I have developed a smaller version which experiences the same problem and is attached. The start button will start the clock and the Bounce button will bounce the clock. Once you have hit the start button just hit the bounce button a few times. Then close the app and start again. To see the effect you need two different computers and click the buttons at the same time to see the marker move.
Here are my results:
1) Mobile Intel Pentium 4M, (Windows XP), 1733MHz(5x347) IBM Thinkpad laptop with ATI Mobility RADEON 7500 Video card - Woks fine
2) AMD Duron XP, (Windows 2000), 1000Mhz(5x200) with Trident CyberBlade-i7 - works fine
3) Mobile Intel Pentium IIIE, (Windows 2000), 1000MHz(10x100) with S3 Graphics Savage/IX 1014 video card - Works fime
4) AMD Athlon XP-A, (Windows 2000), 1100MHz(5.5x200) with NVIDEA GeForce4 MX440 with AGP8X video card - Runs slow
5) Intel Celeron 4A, 2400MHz(6x400) and onboard video SIS 315 - Runs Slow
6) I have details of another box an old Dell Optiplex that works as well. Let me know if you need the specs for this.
I thought maybe it could be a video card problem, but can't see any problems out there of this kind.
Would be great if you could point me in the direction of what it might be to run slow on one box and not another
I have attached the .exe file and the C# code file.
------------------------------------------------------------------------
By the way the Dell Optiplex (no. 6) is a PII 300MHz with onboard ATI Tech 3D Rage Pro AGP.
As you can see the computer hardware varies and note computer 4 runs slow whereas 6 runs ok.
Andrej Ruckij
sjcrichton
THanks for the posting dk. Yes, I am using the timer to tell my clock to update and I am using the DateTime.NOW to get the time. Just like Charles Petzold described in his book "Programming Microsoft Windows with C#". However, I don't think Mr Petzold considered using it in conjunction over many computers at the same time when he designed his clock.

Still looking for a hint.
regards
Andrew Chapman
I will leave this thread open for the moment in case anyone else may want to add a hint or suggestion. Remember, hints or suggestions do not have to be accurate as brain storming is just getting ideas out there.
Robert.Jack
cheers
Robert Accettura
r1zky
Any other suggestions out there
iscbaltazar
If you are running on a machine that has an Internet connection you could try getting the time from a Web Service. I believe there are some out there. Hope this helps...
tim00
You can use a timer to redraw your clock - but you might want to fetch the system time from time to time to correct your clock.
Slybacon
I still have to ask, is it just that your clock is updating slowly or is it actually keeping incorrect time Note: if it is just in the speed in which your analog clock updates (i.e., second hand doesn't sweep as smoothly) then I would still take a look at the hardware.
Even though you may add your own checks to the time from the beginning to the end in your code, you still cannot account for all of the hardware interrupts that may have occurred on a particularly 'slow' system that may have inhibited your video driver updating your display.
It may be something as simple as updating a video driver or just replacing horribly designed hardware. Even still, it might be choosing a decent motherboard. Again, I'm only making a guess here, but it smells like it's a hardware issue.
Regards,
Joe
willis3000
Well folks, I found something on my search. I will keep looking. This is an extract from a C# tutorial:
......introduce the Pen and the Brush objects. These objects are members of GDI+ library. GDI+ or GDI.NET is a graphics library that lets you draw on a form. Prior to .NET, C programmers were using GDI library to create breathtaking graphics. GDI.NET is in fact just a wrapper for GDI. GDI+ is a great platform for moderately complicated static graphs. However, it tends to be slow for moving images and not sophisticated enough for 3 dimensional graphics. On Windows NT platforms, GDI+ as well as GDI do not perform very well. The problem lies in the way GDI/GDI+ runs. Windows NT architecture accepts user input in so called user context and access graphics devices in system context. When GDI/GDI+ application runs on Windows NT based machine, it has to constantly wait for these context switches to occur. This makes GDI/GDI+ applications too slow for video game programming and fancy 3 D graphics. Microsoft recently released a highly optimized graphics platform - Managed DirectX.......
Hmmm...could be a clue..still looking....
mciv34
All the delays (nano seconds - nS) for the working computers are approx the same and all the delays for the slow computers are approx the same.
ie ~ 16,000,000 nS for the working and ~ 20,000,000 nS for the slow. Or it could be the other way around. ie the correct working speed could be the slower time.
This has me a little dumb founded. Microsoft has said that I should change the code to C++ to increase the efficiency and mentions links about timers(which are the basic ones). They have been no use. I sent the rep looking after me the small snippet of code and the exe file and they didn't even test it before they gave me there standard reply. You would think that Microsoft would be interested in issues affecting there O/S.
Changing the code will do no good in solving the delay difference between the different computers. And the difference is the same for all the computers that are running slow(regardless of their video cards or on board video or CPU speed).
Talk about frustration!
Thanks to those who have commented so far. Any one else feel free. You can even comment about Microsoft's help service if you like...:o)