|
-
October 25th, 2001, 11:32 PM
#1
SetSystemTime
I'm trying to set the system time.
SCENERIO:
Through Socket, Server sends it current FILETIME to client. Client gets the SYSTEMTIME from the sent time and then call SetSystemTime() using this system time. But the set time is differnt by +/- GMT TIME DIFFERENCE ('coz of the TIME_ZONE). Can somebody suggest how to make it work. (I've tried but could'nt handle Getting Timezoneinfo and Setting timezone info)
Best Wishes
Asim Hussnain
(Intech)
-
March 6th, 2002, 05:15 AM
#2
Re: SetSystemTime
Hi
Here is a code that work in our system.
lJulianTime - long number that hold the julian seconds.
TIME_ZONE_INFORMATION lp;
GetTimeZoneInformation(&lp);
long l = (lJulianTime / 60 + lp.Bias) * 60;
CTime CurrentTime(l);
SYSTEMTIME* SystemTime = new SYSTEMTIME();
SystemTime->wDay = CurrentTime.GetDay();
SystemTime->wDayOfWeek = CurrentTime.GetDayOfWeek();
SystemTime->wHour = CurrentTime.GetHour();
SystemTime->wMilliseconds = 0;
SystemTime->wMinute = CurrentTime.GetMinute();
SystemTime->wMonth = CurrentTime.GetMonth();
SystemTime->wSecond = CurrentTime.GetSecond();
SystemTime->wYear = CurrentTime.GetYear();
BOOL B = SetSystemTime (SystemTime);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|