Click to See Complete Forum and Search --> : help needed


blazerguns
September 15th, 2006, 02:53 AM
Hi all,

Iam developing a web application where iam using backend as c#. I Use PInvoke method to use GetLocalTime(). It works fine but as soon as i change the timezone through mu system clock the new updated time is not shown when i recall GetLocalTime(). It still shows the old time. Why? I dont understand how GetLocalTime() works. Even better if anyone can tell me how to solve this problem. If i restart the web application then the change is made.

Varun

sreehari
September 15th, 2006, 03:04 AM
you can read more on System Time (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getlocaltime.asp) also read on SYSTEMTIME structure (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/systemtime_str.asp) as this is what MSDN has to say.


It is not recommended that you add and subtract values from the SYSTEMTIME structure to obtain relative times. Instead, you should

* Convert the SYSTEMTIME structure to a FILETIME structure.
* Copy the resulting FILETIME structure to a ULARGE_INTEGER structure.
* Use normal 64-bit arithmetic on the ULARGE_INTEGER value.

The system can periodically refresh the time by synchronizing with a time source. Because the system time can be adjusted either forward or backward, do not compare system time readings to determine elapsed time. Instead, use one of the methods described in Windows Time.