Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Synchronize two PCs
Message
From
31/07/2007 15:02:42
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
31/07/2007 12:33:43
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01244898
Message ID:
01244976
Views:
16
I have no idea about your question, but I just create a file on a shared folder on the server, and check for its date/time. This will allow me to check if the local clock is more than 10 minutes off.

If it is, I leave it up to the user to correct the time, or the timezone. But the user can't enter the application until the time is corrected.

>Hi there, I got this code from an old Thread two set the time of a PC with the time of the another one
>
>
>lcTemp = forcepath(sys(2015)+'.tmp', 'd:\aaa')
>Strtofile('x',m.lcTemp)
>Adir(arrFile,m.lcTemp)
>Erase (m.lcTemp)
>ltNow = (Ctot(Transform(Dtoc(arrFile[3],1),'@R ^9999/99/99')+' '+arrFile[4]))
>
>SetSystemDate(m.ltNow)
>
>Function SetSystemDate
>  Lparameters tdDate
>  Declare Integer SetLocalTime In win32api String @ lpTime
>  Declare Integer GetLocalTime In win32api String @ lpTime
>  Local lpCurrent, lcNewTime
>  lpCurrent = Space(40)
>  GetLocalTime(@lpCurrent) && save current
>
>  lcNewTime = Num2Word(Year(m.tdDate))+;
>    Num2Word(Month(m.tdDate))+;
>    Num2Word(Dow(m.tdDate))+;
>    Num2Word(Day(m.tdDate))+;
>    Substr(m.lpCurrent,9)
>
>  SetLocalTime(@lcNewTime)
>  SetLocalTime(@lcNewTime)
>EndFunc
>
>Function Num2Word
>  Lparameters tnDecimal
>  Return Chr(m.tnDecimal%256)+Chr(Int(m.tnDecimal/256))
>EndFunc
>
>
>
>Now I cannot see any change of time. I guess it is due to the fact that this code
>
>  lcNewTime = Num2Word(Year(m.tdDate))+;
>    Num2Word(Month(m.tdDate))+;
>    Num2Word(Dow(m.tdDate))+;
>    Num2Word(Day(m.tdDate))+;
>    Substr(m.lpCurrent,9)
>
>set the date of the remote PC and the time of this one (lpcurrent) so ,how can I set also the time of the remote pc ?
>Another question:
>Why the line SetLocalTime(@lcNewTime) is repeted twice ?
>Thanks
>Alessio
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform