In using the three methods
CTime::GetCurrentTimeUsing VS2005 Beta 2, I get three different values, respectively, when the local time is 11:58, 2005-11-25:
::GetLocalTime
::GetSystemTime
2005-11-24T15:58:12. Time Zone Information via ::GetTimeZoneInformation shows
2005-11-25T11:58:12
2005-11-24T22:58:12
Bias: -720So from all of the above, I can explain the diff in the results between ::GetLocalTime (local time zone == UTC + all bias) and ::GetSystemTime (UTC). But why the diff between ::GetLocalTime and CTime::GetCurrentTime I would have expected these to be the same.
Standard bias: 0
Daylight bias: -60
VS2005 Beta 2
Windows Mobile 2003 / 5.0 emulators
Windows Mobile 2003 / 5.0 devices

Cannot explain diff in values returned from CTime::GetCurrentTime and ::GetLocalTime
AJ13
http://msdn.microsoft.com/library/default.asp url=/library/en-us/vcmfc98/html/_mfc_ctime.asp
has more details.
Hope that helps
Thanks,
Sadagopan Rajaram
VSD Development Lead
Hope that helps
C#Geek
lex3
http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx feedbackid=647c3de7-cfd6-49fc-8dd7-f49aeba4b771
You can track the issue at the link above.
Thanks,
Sadagopan Rajaram
VSD Development Lead
Huseyin Akturk
Robert.Altland
2>tzfix.obj : error LNK2001: unresolved external symbol _timezone
Am I missing something
Boulderdude
Has anyone found a solution to the linker error problem above I'm getting the same linker errors as well. I have a system that needs to be released in a couple of weeks and really need a solution to this. I'm a bit skeptical of running my system on beta software (i.e. SP1 beta).
I seem to be experiencing the same type of problem when calling GetHour() on a CTime object. It returns a time that is 8 hours different for me when my time is in UTC. Anybody else having this problem
Also, does anybody know when VS SP1 is coming According to the download page for the Beta Program, it is due in December. Anybody know what part of December, the beginning The end Possibly January
webflier
Oops, sorry about that. I actually missed the digit difference in the hour between CTime::GetCurrentTime and ::GetSystemTime.
I looked over the implementation of CTime and it uses _time64 to initialize the CTime structure which should be equivalent to ::GetSystemTime.
However, when you try to use the GetAsSystemTime which should return the local time in a system time structure on the value returned by the GetCurrentTime API, it fails. I assume that this is the problem you are referring to.
When I looked into the CRT implementation of the time functions, we have an issue where we do not update the timezone information from the default of Pacific Standard Time when we initialize using __tzset. This is a bug in the CRT implementation shipped with VS 2005.
As a rather poor workaround, you can reimplement the __tzset function to do the right thing and call it in the main function. Here is the code for the function. This code is not complete and will work only when there is no daylight bias.
void
__cdecl __tzset(void){
int negdiff = 0;
long timezone = 0;
int daylight = 0;
long dstbias = 0;
TIME_ZONE_INFORMATION tzinfo;
if ( GetTimeZoneInformation( &tzinfo ) != 0xFFFFFFFF ) {
timezone = tzinfo.Bias * 60;
if ( tzinfo.StandardDate.wMonth != 0 )
timezone += (tzinfo.StandardBias * 60);
if ( (tzinfo.DaylightDate.wMonth != 0) &&
(tzinfo.DaylightBias != 0) )
{
daylight = 1;
dstbias = (tzinfo.DaylightBias - tzinfo.StandardBias) *
60;
}
else {
daylight = 0;
dstbias = 0;
}
}
_timezone = timezone;
_daylight = daylight;
}
Can you please open a bug on the product feedback center at http://lab.msdn.microsoft.com/ProductFeedback so that you can keep track of the progress we are making on the issue
Thanks and sorry for the earlier post,
Sadagopan Rajaram
VSD development lead.
ahmed921983
----2>tzfix.obj : error LNK2001: unresolved external symbol _daylight
----2>tzfix.obj : error LNK2001: unresolved external symbol _timezone
Same problem here!
jkeele
I see that what you say would explain the difference between CTime::GetCurrentTime and ::GetLocalTime.
However, if the CTime is UTC as the documentation says, then it should match ::GetSystemTime, should it not That also is UTC:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/wcecoreos5/html/wce50lrfgetsystemtime.asp
My apologies if I did not phrase my original question correctly, but I think my problem remains. Of the three times returned, two of them are meant to be UTC - the results from CTime::GetCurrentTime and ::GetSystemTime. But the results do not match. I find that ::GetSystemTime and ::GetLocalTime are correct (UTC and UTC +bias, respectively). Correct in that they match the time on the test devices, at least. I can find no explanation for why CTime::GetCurrentTime is so different. That is my problem.
In short, the result from the API methods correct, yet the CTime method result does not. Can you shed any more light on this please
As a point of note, this problem did not seem to be apparent when the same code was executed using a build via eVC4. It was noted only after migration to VS2005 Beta 2.
Thanks,
bygosh.
Sébastien Nunes
Hi
We have fixed this issue in the SP1 beta available here - http://connect.microsoft.com/VisualStudio/content/content.aspx ContentID=3311. This also has more details on the SP1 release
Please let me know if this beta fixes the relevant issue.
Thanks,
Sadagopan Rajaram