[image]

Работа в timezone в Windows.

 
+
-
edit
 

Mishka

модератор
★★★
Поскольку ТЕвг не имеет доступа к MSDN



Platform SDK: Windows System Information

GetTimeZoneInformation

The GetTimeZoneInformation function retrieves the current time-zone parameters. These parameters control the translations between Coordinated Universal Time (UTC) and local time.


DWORD GetTimeZoneInformation(
LPTIME_ZONE_INFORMATION lpTimeZoneInformation
);

Parameters
lpTimeZoneInformation
[out] Pointer to a TIME_ZONE_INFORMATION structure to receive the current time-zone parameters.
Return Values
If the function succeeds, the return value is one of the following values.


Value Meaning
TIME_ZONE_ID_UNKNOWN The system cannot determine the current time zone. This error is also returned if you call the SetTimeZoneInformation function and supply the bias values but no transition dates.
Windows NT/2000/XP: This value is returned if daylight saving time is not used in the current time zone, because there are no transition dates.

TIME_ZONE_ID_STANDARD The system is operating in the range covered by the StandardDate member of the TIME_ZONE_INFORMATION structure.
Windows 95/98/Me: This value is returned if daylight saving time is not used in the current time zone, because there are no transition dates.

TIME_ZONE_ID_DAYLIGHT The system is operating in the range covered by the DaylightDate member of the TIME_ZONE_INFORMATION structure.


и

Platform SDK: Windows System Information

TIME_ZONE_INFORMATION

The TIME_ZONE_INFORMATION structure specifies information specific to the time zone.


typedef struct _TIME_ZONE_INFORMATION { LONG Bias; WCHAR StandardName[32]; SYSTEMTIME StandardDate; LONG StandardBias; WCHAR DaylightName[32]; SYSTEMTIME DaylightDate; LONG DaylightBias;
} TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION;
Members
Bias
Current bias for local time translation on this computer, in minutes. The bias is the difference, in minutes, between Coordinated Universal Time (UTC) and local time. All translations between UTC and local time are based on the following formula:
UTC = local time + bias
This member is required.

StandardName
Pointer to a null-terminated string associated with standard time on this operating system. For example, this member could contain "EST" to indicate Eastern Standard Time. This string is not used by the operating system, so anything stored there using the SetTimeZoneInformation function is returned unchanged by the GetTimeZoneInformation function. This string can be empty.
StandardDate
A SYSTEMTIME structure that contains a date and local time when the transition from daylight saving time to standard time occurs on this operating system. If this date is not specified, the wMonth member in the SYSTEMTIME structure must be zero. If this date is specified, the DaylightDate value in the TIME_ZONE_INFORMATION structure must also be specified.
To select the correct day in the month, set the wYear member to zero, the wDayOfWeek member to an appropriate weekday, and the wDay member to a value in the range 1 through 5. Using this notation, the first Sunday in April can be specified, as can the last Thursday in October (5 is equal to "the last").

StandardBias
Bias value to be used during local time translations that occur during standard time. This member is ignored if a value for the StandardDate member is not supplied.
This value is added to the value of the Bias member to form the bias used during standard time. In most time zones, the value of this member is zero.

DaylightName
Pointer to a null-terminated string associated with daylight saving time on this operating system. For example, this member could contain "PDT" to indicate Pacific Daylight Time. This string is not used by the operating system, so anything stored there by using the SetTimeZoneInformation function is returned unchanged by the GetTimeZoneInformation function. This string can be empty.
DaylightDate
A SYSTEMTIME structure that contains a date and local time when the transition from standard time to daylight saving time occurs on this operating system. If this date is not specified, the wMonth member in the SYSTEMTIME structure must be zero. If this date is specified, the StandardDate value in the TIME_ZONE_INFORMATION structure must also be specified.
To select the correct day in the month, set the wYear member to zero, the wDayOfWeek member to an appropriate weekday, and the wDay member to a value in the range 1 through 5. Using this notation, the first Sunday in April can be specified, as can the last Thursday in October (5 is equal to "the last").

DaylightBias
Bias value to be used during local time translations that occur during daylight saving time. This member is ignored if a value for the DaylightDate member is not supplied.
This value is added to the value of the Bias member to form the bias used during daylight saving time. In most time zones, the value of this member is – 60.

Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winbase.h; include Windows.h.


See Also
Time Overview, Time Structures, GetTimeZoneInformation, SetTimeZoneInformation, SYSTEMTIME


Platform SDK Release: August 2002

If the function fails, the return value is TIME_ZONE_ID_INVALID. To get extended error information, call GetLastError.


Remarks
All translations between UTC time and local time are based on the following formula:


UTC = local time + bias

The bias is the difference, in minutes, between UTC time and local time.

Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.


See Also
Time Overview, Time Functions, SetTimeZoneInformation, TIME_ZONE_INFORMATION


Platform SDK Release: August 2002
   
+
-
edit
 

Mishka

модератор
★★★
Вот - еще забыл




Platform SDK: Windows System Information

SYSTEMTIME

The SYSTEMTIME structure represents a date and time using individual members for the month, day, year, weekday, hour, minute, second, and millisecond.


typedef struct _SYSTEMTIME { WORD wYear; WORD wMonth; WORD wDayOfWeek; WORD wDay; WORD wHour; WORD wMinute; WORD wSecond; WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME;
Members
wYear
Current year. The year must be greater than 1601.
Windows XP: The year cannot be greater than 30827.

wMonth
Current month; January = 1, February = 2, and so on.
wDayOfWeek
Current day of the week; Sunday = 0, Monday = 1, and so on.
wDay
Current day of the month.
wHour
Current hour.
wMinute
Current minute.
wSecond
Current second.
wMilliseconds
Current millisecond.
Remarks
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.

Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winbase.h; include Windows.h.


See Also
Time Overview, Time Structures, FILETIME, GetSystemTime, ULARGE_INTEGER, SetSystemTime


Platform SDK Release: August 2002
   
+
-
edit
 

=KRoN=
Balancer

администратор
★★★★★
Mishka>Windows XP: The year cannot be greater than 30827.

Ох, хреново-то как :D
   
+
-
edit
 

=KRoN=
Balancer

администратор
★★★★★
И всё-таки, ИМХО, самая красивая работа со временем на Perl'е :)
   
+
-
edit
 

Mishka

модератор
★★★
Крон, это я для ТЕвга - он в радостях жизни приставал с вопросами как определить лентнее время в форточках. А MSDN у него забанен.
   

в начало страницы | новое
 
Поиск
Настройки
Твиттер сайта
Статистика
Рейтинг@Mail.ru