PC Time Update From Internet 
Author Message
 PC Time Update From Internet

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.


Thu, 10 May 2012 00:11:01 GMT  
 PC Time Update From Internet

Quote:

> 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.

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

--



Thu, 10 May 2012 00:15:58 GMT  
 PC Time Update From Internet

Quote:
>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.

See this VB6 sample:

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

Or use this free alternative:

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



Thu, 10 May 2012 00:29:13 GMT  
 PC Time Update From Internet
  On XP and later it takes some effort *not* to
keep the time updated. The W32Time runs
by default and contacts Microsoft for updates!

Quote:
> 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.



Thu, 10 May 2012 01:06:44 GMT  
 PC Time Update From Internet


Quote:
> 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.

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

LFS



Thu, 10 May 2012 01:11:20 GMT  
 PC Time Update From Internet
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.
Quote:

>   On XP and later it takes some effort *not* to
> keep the time updated. The W32Time runs
> by default and contacts Microsoft for updates!

> > 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.

> .



Thu, 10 May 2012 05:12:01 GMT  
 PC Time Update From Internet

Quote:

>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



Thu, 10 May 2012 05:35:50 GMT  
 PC Time Update From Internet
Thanks.
I can modify this for what I want.
Quote:



> >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.

> See this VB6 sample:

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

> Or use this free alternative:

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

> .



Thu, 10 May 2012 05:35:01 GMT  
 PC Time Update From Internet

Quote:

>>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.


Thu, 10 May 2012 06:33:32 GMT  
 PC Time Update From Internet
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

Quote:




> >>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.

> .



Thu, 10 May 2012 08:11:01 GMT  
 PC Time Update From Internet


Quote:
> 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:

Quote:
>         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



Thu, 10 May 2012 09:11:19 GMT  
 PC Time Update From Internet
Thanks Larry.
Forest for the trees.
Quote:


> > 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

> .



Thu, 10 May 2012 13:32:01 GMT  
 PC Time Update From Internet

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

Quote:
>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.  



Thu, 10 May 2012 15:29:23 GMT  
 PC Time Update From Internet

Quote:
> 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.


Sat, 12 May 2012 04:30:19 GMT  
 PC Time Update From Internet

Quote:

>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.



Sat, 12 May 2012 06:25:21 GMT  
 
 [ 21 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Updating PC Date/Time via WinAPI

2. Updating the PC time.

3. No errors on development PC, Run-time on user PC

4. Visual Basic 5 and Internet Time Protocal (for a time sync prog)

5. Newbie : Pocket PC/Handheld PC/Palm PC

6. using stopeatch form functions to time an event procedure and update elapsed time control

7. web service and updating web reference with vb.net design time vs run time

8. web service and updating web reference with vb.net design time vs run time

9. Access, share your PC's files remotely over the Internet for free

10. Access, share your PC's files remotely over the Internet for free

11. Access, share your PC's files remotely over the Internet for free

12. Access, share your PC's files remotely over the Internet for free

 

 
Powered by phpBB® Forum Software