SCOUG Logo


Next Meeting: Sat, TBD
Meeting Directions


Be a Member
Join SCOUG

Navigation:


Help with Searching

20 Most Recent Documents
Search Archives
Index by date, title, author, category.


Features:

Mr. Know-It-All
Ink
Download!










SCOUG:

Home

Email Lists

SIGs (Internet, General Interest, Programming, Network, more..)

Online Chats

Business

Past Presentations

Credits

Submissions

Contact SCOUG

Copyright SCOUG



warp expowest
Pictures from Sept. 1999

The views expressed in articles on this site are those of their authors.

warptech
SCOUG was there!


Copyright 1998-2024, Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.

The Southern California OS/2 User Group
USA

SCOUG-Programming Mailing List Archives

Return to [ 12 | September | 2006 ]

<< Previous Message << >> Next Message >>


Date: Tue, 12 Sep 2006 05:58:09 -0700
From: <n_woodruff@bellsouth.net >
Reply-To: scoug-programming@scoug.com
To: <scoug-programming@scoug.com >
Subject: SCOUG-Programming: Ouch! SysSleep(), NTP, cpu clock

Content Type: text/plain

Hi Peter,

I have a motherboard that will take up to a 233Mhz cpu. I was using it to run my alarm system for my house. I was noticing that every day that it would add about 30 seconds to the RTC. It wasn't a real problem for me but after a month or so, the time would really be off.

I found it to be a problem with the motherboard. I replaced the motherboard with a newer one and have never had that problem again. I think it looses a second now every couple of days with the newer motherboard. You may want to think about changing your board out or a new computer.

I also have a program that I wrote that reads nist.time.gov every hour. Their notice on their site says to not get the time any faster than every 15 seconds. Once an hour and they will never say a word to you. The program automatically adjusts for daylight as nist.time.gov has a flag set for it.

The OS/2 API has DosSleep(xx) where xx is miliseconds. It uses the hi-res timer and not the RTC. That may or may not solve your problem as in if the RTC is running fast so might be the hi-res timer.

If you want a copy of my program to set the time every 15 minutes from nist.time.gov, that might solve your problem.

Nathan
>
> From: Peter Skye
> Date: 2006/09/12 Tue AM 07:56:31 EDT
> To: scoug-programming@scoug.com
> Subject: SCOUG-Programming: Ouch! SysSleep(), NTP, cpu clock
>
> This has been a problem here for years and I think I've just figured out
> _what_ is happening but have no idea how to resolve it. Ideas?
> _____
>
> Problem: My own Rexx programs which use SysSleep() "wake up" a tad
> early, for example 10 seconds too early if they sleep for 12 hours. In
> other words, if I SysSleep() for 12 hours beginning at 3:00:00, I might
> wake up at 2:59:50.
>
> Apparent Reason: I use an NTP program to keep my system clock set, and
> my cpu clock is a little fast. In my case I use OS2NTPD which adds a
> half-cycle to the Real Time Clock (RTC) when necessary (other NTP
> programs just reset the clock sporadically). And my cpu clock runs
> fast, iirc it adds about 40 seconds every 24 hours if OS2NTPD isn't
> running.
>
> Analysis: Since my cpu runs fast, OS2NTPD "slows down the RTC" every
> now and then by a half-cycle (1/120 second). But the cpu clock is still
> running at its slightly-fast speed so it will reach the equivalent of
> 3:00:00 _before_ the RTC does (since the RTC is being slowed down).
> That's apparently why I "wake up" too soon -- and if my cpu clock ran
> slow instead of fast then I would wake up a little late instead of a
> little early.
>
> I don't know if cron and other timer programs have a similar problem, I
> haven't tested them.
>
> I do need to do further testing with OS2NTPD turned off, to see if I
> then "wake up" on time. But I need some insight into how SysSleep()
> actually works so I can design the tests.
>
> Question #1: My guess is that SysSleep() isn't using the RTC. Anybody
> know what it uses, or what "timer" calls are available in the OS/2 API?
>
> Question #2: Does anybody have a workaround for the situation where the
> cpu clock isn't exact and an NTP program is occasionally resetting the
> RTC clock? I'd like to test any workarounds.
>
> Question #3: Has this problem surfaced on other platforms, such as *nix
> or Windows?
>
> Question #4: There is a conceptual difference between SysSleep() which
> "waits a specific amount of time" and a hypothetical SleepUntil() or
> WakeUpAt() which wait for a specific match with the system clock. Are
> there any calls, on any platform, for the hypothetical
> SleepUntil()/WakeUpAt()? If so, I'd like to research them.
>
> Somebody is probably going to ask, "Why do you care?" I have a
> radio-broadcast-over-internet project I'm working on and it requires 1/2
> second resolution. Waking up too early or too late is a problem.
>
> (One possible workaround: SysSleep() for half the desired time, then
> recalculate the remaining sleep time based on the current RTC value and
> repeat until the desired clock time is reached.)
>
> Yes I know that Daylight Saving boundaries are a problem on OS/2. I'll
> deal with that one later.
>
> - Peter
>
>
>
> =====================================================
>
> To unsubscribe from this list, send an email message
> to "steward@scoug.com". In the body of the message,
> put the command "unsubscribe scoug-programming".
>
> For problems, contact the list owner at
> "postmaster@scoug.com".
>
> =====================================================
>
>
>

=====================================================

To unsubscribe from this list, send an email message
to "steward@scoug.com". In the body of the message,
put the command "unsubscribe scoug-programming".

For problems, contact the list owner at
"postmaster@scoug.com".

=====================================================


<< Previous Message << >> Next Message >>

Return to [ 12 | September | 2006 ]



The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA

Copyright 2001 the Southern California OS/2 User Group. ALL RIGHTS RESERVED.

SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group. OS/2, Workplace Shell, and IBM are registered trademarks of International Business Machines Corporation. All other trademarks remain the property of their respective owners.