Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting the system clock on the fly
Message
From
06/08/2008 20:32:31
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01337084
Message ID:
01337110
Views:
10
thank Hugo, it doesn't seem to work but i will test it better tomorrow.
>Alessio,
>
>>the function i use it is good to change the date. As time it takes the current time so ...nothing happens :)
>>I don't know how to format the time portion of the datetime :(
>
>Sorry, I read that it was working but now it was not working anymore and I stopped reading... bad bad Hugo
>
>try this:
>
>
>SetSystemDate(Datetime(2006, 12, 10,10,10,10))
>Function SetSystemDate
>  Lparameters tdDate
>  Declare Integer SetLocalTime In win32api String @ lpTime
>  Declare Integer GetLocalTime In win32api String @ lpTime
>  Local lpCurrent, lcNewDateTime, lcNewTime
>
>  lcNewTime	= Right(Ttoc(tddate, 1), 6)
>  lpCurrent = Space(40)
>  GetLocalTime(@lpCurrent) && save current
>
>  lcNewDateTime = Num2Word(Year(m.tdDate))+;
>    Num2Word(Month(m.tdDate))+;
>    Num2Word(Dow(m.tdDate))+;
>    Num2Word(Day(m.tdDate))+;
>    Num2Word(Val(Left(m.lcNewTime, 2))) +;
>    Num2Word(Val(Substr(m.lcNewTime, 3, 2))) +;
>    Num2Word(Val(Right(m.lcNewTime, 2)))
>
>  SetLocalTime(@lcNewDateTime)
>*  SetLocalTime(@lcNewTime)
>
>EndFunc
>
>Function Num2Word
>  Lparameters tnDecimal
>  Return Chr(m.tnDecimal%256)+Chr(Int(m.tnDecimal/256))
>EndFunc
>
>
>Remember that you might get different time if you have DST (I tested and seems to work)
Previous
Reply
Map
View

Click here to load this message in the networking platform