Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PC Time Update From Internet

2 views
Skip to first unread message

Bee

unread,
Nov 21, 2009, 11:11:01 AM11/21/09
to
I would like a VB6 app that will cause the PC to get updated to internet time.
Is there an API to do this?
I found nothing while searching but probably do not know the terminology to
search for.

dpb

unread,
Nov 21, 2009, 11:15:58 AM11/21/09
to

Don't know about the APIs; far simpler to just use one of the available
net time service daemons. Why isn't that satisfactory?

--

Nobody

unread,
Nov 21, 2009, 11:29:13 AM11/21/09
to
"Bee" <B...@discussions.microsoft.com> wrote in message
news:8651CEFC-04E5-453C...@microsoft.com...

See this VB6 sample:

http://vbnet.mvps.org/code/network/winsocksynctime.htm

Or use this free alternative:

http://www.gregorybraun.com/WebTime.html


mayayana

unread,
Nov 21, 2009, 12:06:44 PM11/21/09
to
On XP and later it takes some effort *not* to
keep the time updated. The W32Time runs
by default and contacts Microsoft for updates!

Larry Serflaten

unread,
Nov 21, 2009, 12:11:20 PM11/21/09
to

"Bee" <B...@discussions.microsoft.com> wrote

Here's some info you might find useful...
http://tf.nist.gov/service/its.htm

LFS


Bee

unread,
Nov 21, 2009, 4:12:01 PM11/21/09
to
On a one year old Vista PC the clock loses over one minute per day and does
not update but every several days. This is unacceptable behavior.
It has power on all the time so something is wrong but I would rather just
force time updates myself every four hours or so.


"mayayana" wrote:

> .
>

David Kaye

unread,
Nov 21, 2009, 4:35:50 PM11/21/09
to
"Nobody" <nob...@nobody.com> wrote:

>Or use this free alternative:
>
>http://www.gregorybraun.com/WebTime.html

As for me, I just changed the update interval to sync every 6 hours instead of
once a week, so I don't need to run anything to make sure my clock is
synchronize more often than once a week.

Here's a copy of my registry entry. Just copy the next lines and save it as a
file called timeupdate.reg and run it once. It'll reset the update to 6-hour
intervals. Of course you can also modify the "Special Poll Interval" to a
lower or higher number to adjust the update interval.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\Nt
pClient]
"Enabled"=dword:00000001
"InputProvider"=dword:00000001
"AllowNonstandardModeCombinations"=dword:00000001
"CrossSiteSyncFlags"=dword:00000002
"ResolvePeerBackoffMinutes"=dword:0000000f
"ResolvePeerBackoffMaxTimes"=dword:00000007
"CompatibilityFlags"=dword:80000000
"EventLogFlags"=dword:00000000
"DllName"="C:\\WINDOWS\\system32\\w32time.dll"
"SpecialPollTimeRemaining"=hex(7):74,00,69,00,6d,00,65,00,2e,00,6e,00,69,00,73,
\
00,74,00,2e,00,67,00,6f,00,76,00,2c,00,30,00,00,00,00,00,00,00,00,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
00
"SpecialPollInterval"=dword:00005460


Bee

unread,
Nov 21, 2009, 4:35:01 PM11/21/09
to
Thanks.
I can modify this for what I want.

"Nobody" wrote:

> .
>

Nobody

unread,
Nov 21, 2009, 5:33:32 PM11/21/09
to
"David Kaye" <sfdavi...@yahoo.com> wrote in message
news:he9mfm$nci$2...@news.eternal-september.org...

> "Nobody" <nob...@nobody.com> wrote:
>
>>Or use this free alternative:
>>
>>http://www.gregorybraun.com/WebTime.html
>
> As for me, I just changed the update interval to sync every 6 hours
> instead of
> once a week, so I don't need to run anything to make sure my clock is
> synchronize more often than once a week.

I use WebTime because it keeps a log which I can analyze later. I can run it
using Task Scheduler and use /auto switch. I lose one second every day on my
Gigabyte motherboard, which is 1 to 2 years old. I am using XP+SP2. I don't
think that computer clocks are that inaccurate, but something else is going
on.



Bee

unread,
Nov 21, 2009, 7:11:01 PM11/21/09
to
The site sighted has an error in the calculation.
http://vbnet.mvps.org/code/network/winsocksynctime.htm


All active sources return the same code.
it is then decoded incorrectly.

The calculation returns the year 1919
UTC 11/21/1919 12:07:50 AM GMT
PC 11/21/2009 4:07:49 PM PST
Close but no cigar.

NTPTime = Asc(Left$(sTime, 1)) * (256 ^ 3) + Asc(Mid$(sTime, 2, 1))
* (256 ^ 2) + Asc(Mid$(sTime, 3, 1)) * (256 ^ 1) + Asc(Right$(sTime, 1))

'and create a valid date based on
'the seconds since January 1, 1990
dwSecondsSince1990 = NTPTime - 2840140800#
UTCDATE = DateAdd("s", CDbl(dwSecondsSince1990), 1 / 1 / 1990)

'fill a SYSTEMTIME structure with the appropriate values
With ST
.wYear = Year(UTCDATE)
.wMonth = Month(UTCDATE)
.wDay = Day(UTCDATE)
.wHour = Hour(UTCDATE)
.wMinute = Minute(UTCDATE)
.wSecond = Second(UTCDATE)
End With

"Nobody" wrote:

> .
>

Larry Serflaten

unread,
Nov 21, 2009, 8:11:19 PM11/21/09
to

"Bee" <B...@discussions.microsoft.com> wrote


> The site sighted has an error in the calculation.
> http://vbnet.mvps.org/code/network/winsocksynctime.htm

> UTCDATE = DateAdd("s", CDbl(dwSecondsSince1990), 1 / 1 / 1990)

Be sure to include the # for dates:

> UTCDATE = DateAdd("s", CDbl(dwSecondsSince1990), #1 / 1 / 1990#)

What you show equates to a couple of divisions:

1 / 1 / 1990 = 5.025126E-04

Thats not the number you want! Its supposed to be 32874.

LFS


Bee

unread,
Nov 22, 2009, 12:32:01 AM11/22/09
to
Thanks Larry.
Forest for the trees.


"Larry Serflaten" wrote:

> .
>

David Kaye

unread,
Nov 22, 2009, 2:29:23 AM11/22/09
to
"Nobody" <nob...@nobody.com> wrote:

[....]motherboard, which is 1 to 2 years old. I am using XP+SP2. I don't

>think that computer clocks are that inaccurate, but something else is going
>on.

You're using too many CPU cycles.

There are two clocks we're talking about here, the RTC or realtime clock, the
battery-operated clock on a chip on the mother board and the system clock, the
software clock that operates on CPU cycles as your computer runs.

The clock you see and use in programs is the system clock. It is likely to be
inaccurate unless reset often because as the CPU bogs down the system clock
may not be updated as often. Sometimes the system clock is set to advance a
little to make up for the CPU losses, which means that if you are running a
computer with very little load, the system clock may run faster than real
time.

I'd bet that if you turned off your computer when your time is really
inaccurate and then rebooted, you'd find that the time was fairly accurate
once again. That's because the system clock polls the RTC during bootup.

Most clock-setting software including Windows' own resets both the RTC and the
system clocks.

Again, I find that changing the registry value for the time setting interval
is a no muss no fuss way to keep the clocks accurate.

Jeff Johnson

unread,
Nov 23, 2009, 3:30:19 PM11/23/09
to
"David Kaye" <sfdavi...@yahoo.com> wrote in message
news:he9mfm$nci$2...@news.eternal-september.org...

> As for me, I just changed the update interval to sync every 6 hours

> instead of
> once a week, so I don't need to run anything to make sure my clock is
> synchronize more often than once a week.

Can you explain that sentence to me? It sounds like you totally contradicted
yourself.


David Kaye

unread,
Nov 23, 2009, 5:25:21 PM11/23/09
to
"Jeff Johnson" <i....@enough.spam> wrote:

>Can you explain that sentence to me? It sounds like you totally contradicted
>yourself.

I thought it was fairly clear. Left to its own devices, Windows synchronizes
once a week. I changed the setting to sync every 6 hours. I copied the
registry keys and posted them here so that anyone else may do it as well.

Since Windows takes care of the time sync I don't have to run any programs or
applets to do it.

Ralph

unread,
Nov 23, 2009, 6:14:12 PM11/23/09
to

"David Kaye" <sfdavi...@yahoo.com> wrote in message
news:heap8j$kil$4...@news.eternal-september.org...

lol

Ghod, I just love this.

Boxes losing time is a minor problem that just seemed to mysteriously
appear. Over the years I've seen it blamed on motherboards, applications,
networks, etc. I've seen all kinds of fixes, but have never seen it
explained so well, or so simply repaired.

Thanks
-ralph


David Kaye

unread,
Nov 23, 2009, 6:41:54 PM11/23/09
to
"Ralph" <nt_cons...@yahoo.com> wrote:

>Boxes losing time is a minor problem that just seemed to mysteriously
>appear. Over the years I've seen it blamed on motherboards, applications,
>networks, etc. I've seen all kinds of fixes, but have never seen it
>explained so well, or so simply repaired.

Thank you! I appreciate the comment.

Many times I've turned on old computers that hadn't been run in months or even
a couple years. The clock was usually fairly accurate (within maybe 10 to 20
seconds) because the RTC (real time clock) is as accurate as a wristwatch.

I'm actually surprised that neither Windows nor the BIOS makers have thought
to update the system clock against the RTC more often than at bootup. Heck,
they could do it once an hour or every 10 minutes or whatever and it wouldn't
be any problem. They have a perfectly fine clock onboard and they're not
using it much.

But, the Windows registry time polling tweak takes care of all that anyway.

Jeff Johnson

unread,
Nov 24, 2009, 9:38:30 AM11/24/09
to
"David Kaye" <sfdavi...@yahoo.com> wrote in message
news:hef24e$9r8$2...@news.eternal-september.org...

> As for me, I just changed the update interval to sync every 6 hours
> instead of
> once a week, so I don't need to run anything to make sure my clock is
> synchronize more often than once a week.

>>Can you explain that sentence to me? It sounds like you totally

Okay, but in the original post you said you "don't need to run
anything...more often than once a week," suggesting that you DO need to run
something once a week, just not any more frequently than that. Then in your
reply to me you said to don't need to run any programs at all. See my
confusion?


Saga

unread,
Nov 24, 2009, 1:23:04 PM11/24/09
to
> Here's some info you might find useful...
> http://tf.nist.gov/service/its.htm

Of course, when I decide to click the link the site is down for maintenance
:-S

Full link gives 404 error, domain only tells me that it is undergoing
maintenance.
I'll try again later. Thanks, Saga


Nobody

unread,
Nov 24, 2009, 1:42:07 PM11/24/09
to
"Saga" <anti...@nowhere.com> wrote in message
news:ueF6rMTb...@TK2MSFTNGP04.phx.gbl...

http://web.archive.org/web/20080822214340/http://tf.nist.gov/service/its.htm


Saga

unread,
Nov 25, 2009, 3:46:18 PM11/25/09
to
0 new messages