The information in this article applies to:
SYMPTOMSUnder Windows NT, the C run-time (CRT) functions, localtime() or ctime() returns the correct local time. However, under Win32s, either ctime() or localtime() does not display the correct time from a 32-bit application when the TZ environment variable is not set to zero. CAUSE
The ctime() and localtime() functions depends on time zone information that
is not available in Win32s. This is the reason that the Win32 API
GetLocalTime() is not supported under Win32s. The C Run-time time
functions, like localtime(), use the TZ environment variable for time zone
information.
RESOLUTION
If TZ is set to zero, the time is displayed correctly. To get the current
local time under both Win32s and Windows NT, use the following code to
clear the TZ environment variable and get the time:
Note that _putenv() affects only the TZ environment variable for the application. All other applications use the global environment settings and make their own modifications. STATUSThis behavior is by design. MORE INFORMATIONSteps to Reproduce BehaviorThe following sample code demonstrates the problem (the time is shifted by several hours):
Additional query words: crt gmt
Keywords : kbprg kbWin32s |
Last Reviewed: March 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |