2 * Win32 kernel time functions
4 * Copyright 1995 Martin von Loewis and Cameron Heide
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
30 #ifdef HAVE_SYS_TIME_H
31 # include <sys/time.h>
33 #ifdef HAVE_SYS_TIMES_H
34 # include <sys/times.h>
36 #ifdef HAVE_SYS_LIMITS_H
37 #include <sys/limits.h>
38 #elif defined(HAVE_MACHINE_LIMITS_H)
39 #include <machine/limits.h>
43 #define WIN32_NO_STATUS
44 #define NONAMELESSUNION
48 #include "kernel_private.h"
49 #include "wine/unicode.h"
50 #include "wine/debug.h"
52 WINE_DEFAULT_DEBUG_CHANNEL(time
);
54 #define CALINFO_MAX_YEAR 2029
56 #define LL2FILETIME( ll, pft )\
57 (pft)->dwLowDateTime = (UINT)(ll); \
58 (pft)->dwHighDateTime = (UINT)((ll) >> 32);
59 #define FILETIME2LL( pft, ll) \
60 ll = (((LONGLONG)((pft)->dwHighDateTime))<<32) + (pft)-> dwLowDateTime ;
63 static const int MonthLengths
[2][12] =
65 { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
66 { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
69 static inline BOOL
IsLeapYear(int Year
)
71 return Year
% 4 == 0 && (Year
% 100 != 0 || Year
% 400 == 0);
74 /***********************************************************************
75 * TIME_DayLightCompareDate
77 * Compares two dates without looking at the year.
80 * date [in] The local time to compare.
81 * compareDate [in] The daylight savings begin or end date.
85 * -1 if date < compareDate
86 * 0 if date == compareDate
87 * 1 if date > compareDate
88 * -2 if an error occurs
90 static int TIME_DayLightCompareDate( const SYSTEMTIME
*date
,
91 const SYSTEMTIME
*compareDate
)
93 int limit_day
, dayinsecs
;
95 if (date
->wMonth
< compareDate
->wMonth
)
96 return -1; /* We are in a month before the date limit. */
98 if (date
->wMonth
> compareDate
->wMonth
)
99 return 1; /* We are in a month after the date limit. */
101 /* if year is 0 then date is in day-of-week format, otherwise
102 * it's absolute date.
104 if (compareDate
->wYear
== 0)
107 /* compareDate->wDay is interpreted as number of the week in the month
108 * 5 means: the last week in the month */
109 int weekofmonth
= compareDate
->wDay
;
110 /* calculate the day of the first DayOfWeek in the month */
111 First
= ( 6 + compareDate
->wDayOfWeek
- date
->wDayOfWeek
+ date
->wDay
113 limit_day
= First
+ 7 * (weekofmonth
- 1);
114 /* check needed for the 5th weekday of the month */
115 if(limit_day
> MonthLengths
[date
->wMonth
==2 && IsLeapYear(date
->wYear
)]
121 limit_day
= compareDate
->wDay
;
124 /* convert to seconds */
125 limit_day
= ((limit_day
* 24 + compareDate
->wHour
) * 60 +
126 compareDate
->wMinute
) * 60;
127 dayinsecs
= ((date
->wDay
* 24 + date
->wHour
) * 60 +
128 date
->wMinute
) * 60 + date
->wSecond
;
130 return dayinsecs
< limit_day
? -1 :
131 dayinsecs
> limit_day
? 1 :
132 0; /* date is equal to the date limit. */
135 /***********************************************************************
136 * TIME_CompTimeZoneID
138 * Computes the local time bias for a given time and time zone.
141 * pTZinfo [in] The time zone data.
142 * lpFileTime [in] The system or local time.
143 * islocal [in] it is local time.
146 * TIME_ZONE_ID_INVALID An error occurred
147 * TIME_ZONE_ID_UNKNOWN There are no transition time known
148 * TIME_ZONE_ID_STANDARD Current time is standard time
149 * TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
151 static DWORD
TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION
*pTZinfo
,
152 FILETIME
*lpFileTime
, BOOL islocal
)
155 BOOL beforeStandardDate
, afterDaylightDate
;
156 DWORD retval
= TIME_ZONE_ID_INVALID
;
157 LONGLONG llTime
= 0; /* initialized to prevent gcc complaining */
161 if (pTZinfo
->DaylightDate
.wMonth
!= 0)
163 /* if year is 0 then date is in day-of-week format, otherwise
164 * it's absolute date.
166 if (pTZinfo
->StandardDate
.wMonth
== 0 ||
167 (pTZinfo
->StandardDate
.wYear
== 0 &&
168 (pTZinfo
->StandardDate
.wDay
<1 ||
169 pTZinfo
->StandardDate
.wDay
>5 ||
170 pTZinfo
->DaylightDate
.wDay
<1 ||
171 pTZinfo
->DaylightDate
.wDay
>5)))
173 SetLastError(ERROR_INVALID_PARAMETER
);
174 return TIME_ZONE_ID_INVALID
;
178 FILETIME2LL( lpFileTime
, llTime
);
179 llTime
-= pTZinfo
->Bias
* (LONGLONG
)600000000;
180 LL2FILETIME( llTime
, &ftTemp
)
181 lpFileTime
= &ftTemp
;
184 FileTimeToSystemTime(lpFileTime
, &SysTime
);
185 year
= SysTime
.wYear
;
188 llTime
-= pTZinfo
->DaylightBias
* (LONGLONG
)600000000;
189 LL2FILETIME( llTime
, &ftTemp
)
190 FileTimeToSystemTime(lpFileTime
, &SysTime
);
193 /* check for daylight savings */
194 if(year
== SysTime
.wYear
) {
195 ret
= TIME_DayLightCompareDate( &SysTime
, &pTZinfo
->StandardDate
);
197 return TIME_ZONE_ID_INVALID
;
199 beforeStandardDate
= ret
< 0;
201 beforeStandardDate
= SysTime
.wYear
< year
;
204 llTime
-= ( pTZinfo
->StandardBias
- pTZinfo
->DaylightBias
)
205 * (LONGLONG
)600000000;
206 LL2FILETIME( llTime
, &ftTemp
)
207 FileTimeToSystemTime(lpFileTime
, &SysTime
);
210 if(year
== SysTime
.wYear
) {
211 ret
= TIME_DayLightCompareDate( &SysTime
, &pTZinfo
->DaylightDate
);
213 return TIME_ZONE_ID_INVALID
;
215 afterDaylightDate
= ret
>= 0;
217 afterDaylightDate
= SysTime
.wYear
> year
;
219 retval
= TIME_ZONE_ID_STANDARD
;
220 if( pTZinfo
->DaylightDate
.wMonth
< pTZinfo
->StandardDate
.wMonth
) {
221 /* Northern hemisphere */
222 if( beforeStandardDate
&& afterDaylightDate
)
223 retval
= TIME_ZONE_ID_DAYLIGHT
;
224 } else /* Down south */
225 if( beforeStandardDate
|| afterDaylightDate
)
226 retval
= TIME_ZONE_ID_DAYLIGHT
;
228 /* No transition date */
229 retval
= TIME_ZONE_ID_UNKNOWN
;
234 /***********************************************************************
237 * Calculates whether daylight savings is on now.
240 * pTzi [in] Timezone info.
243 * TIME_ZONE_ID_INVALID An error occurred
244 * TIME_ZONE_ID_UNKNOWN There are no transition time known
245 * TIME_ZONE_ID_STANDARD Current time is standard time
246 * TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
248 static DWORD
TIME_ZoneID( const TIME_ZONE_INFORMATION
*pTzi
)
251 GetSystemTimeAsFileTime( &ftTime
);
252 return TIME_CompTimeZoneID( pTzi
, &ftTime
, FALSE
);
255 /***********************************************************************
256 * TIME_GetTimezoneBias
258 * Calculates the local time bias for a given time zone.
261 * pTZinfo [in] The time zone data.
262 * lpFileTime [in] The system or local time.
263 * islocal [in] It is local time.
264 * pBias [out] The calculated bias in minutes.
267 * TRUE when the time zone bias was calculated.
269 static BOOL
TIME_GetTimezoneBias( const TIME_ZONE_INFORMATION
*pTZinfo
,
270 FILETIME
*lpFileTime
, BOOL islocal
, LONG
*pBias
)
272 LONG bias
= pTZinfo
->Bias
;
273 DWORD tzid
= TIME_CompTimeZoneID( pTZinfo
, lpFileTime
, islocal
);
275 if( tzid
== TIME_ZONE_ID_INVALID
)
277 if (tzid
== TIME_ZONE_ID_DAYLIGHT
)
278 bias
+= pTZinfo
->DaylightBias
;
279 else if (tzid
== TIME_ZONE_ID_STANDARD
)
280 bias
+= pTZinfo
->StandardBias
;
285 /***********************************************************************
286 * TIME_GetSpecificTimeZoneKey
288 * Opens the registry key for the time zone with the given name.
291 * key_name [in] The time zone name.
292 * result [out] The open registry key handle.
295 * TRUE if successful.
297 static BOOL
TIME_GetSpecificTimeZoneKey( const WCHAR
*key_name
, HANDLE
*result
)
299 static const WCHAR Time_ZonesW
[] = { '\\','R','E','G','I','S','T','R','Y','\\',
300 'M','a','c','h','i','n','e','\\',
301 'S','o','f','t','w','a','r','e','\\',
302 'M','i','c','r','o','s','o','f','t','\\',
303 'W','i','n','d','o','w','s',' ','N','T','\\',
304 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
305 'T','i','m','e',' ','Z','o','n','e','s',0 };
306 HANDLE time_zones_key
;
307 OBJECT_ATTRIBUTES attr
;
308 UNICODE_STRING nameW
;
311 attr
.Length
= sizeof(attr
);
312 attr
.RootDirectory
= 0;
313 attr
.ObjectName
= &nameW
;
315 attr
.SecurityDescriptor
= NULL
;
316 attr
.SecurityQualityOfService
= NULL
;
317 RtlInitUnicodeString( &nameW
, Time_ZonesW
);
318 status
= NtOpenKey( &time_zones_key
, KEY_READ
, &attr
);
321 WARN("Unable to open the time zones key\n");
322 SetLastError( RtlNtStatusToDosError(status
) );
326 attr
.RootDirectory
= time_zones_key
;
327 RtlInitUnicodeString( &nameW
, key_name
);
328 status
= NtOpenKey( result
, KEY_READ
, &attr
);
330 NtClose( time_zones_key
);
334 SetLastError( RtlNtStatusToDosError(status
) );
341 static BOOL
reg_query_value(HKEY hkey
, LPCWSTR name
, DWORD type
, void *data
, DWORD count
)
343 UNICODE_STRING nameW
;
345 KEY_VALUE_PARTIAL_INFORMATION
*info
= (KEY_VALUE_PARTIAL_INFORMATION
*)buf
;
348 if (count
> sizeof(buf
) - sizeof(KEY_VALUE_PARTIAL_INFORMATION
))
351 RtlInitUnicodeString(&nameW
, name
);
353 if ((status
= NtQueryValueKey(hkey
, &nameW
, KeyValuePartialInformation
,
354 buf
, sizeof(buf
), &count
)))
356 SetLastError( RtlNtStatusToDosError(status
) );
360 if (info
->Type
!= type
)
362 SetLastError( ERROR_DATATYPE_MISMATCH
);
366 memcpy(data
, info
->Data
, info
->DataLength
);
370 /***********************************************************************
371 * TIME_GetSpecificTimeZoneInfo
373 * Returns time zone information for the given time zone and year.
376 * key_name [in] The time zone name.
377 * year [in] The year, if Dynamic DST is used.
378 * dynamic [in] Whether to use Dynamic DST.
379 * result [out] The time zone information.
382 * TRUE if successful.
384 static BOOL
TIME_GetSpecificTimeZoneInfo( const WCHAR
*key_name
, WORD year
,
385 BOOL dynamic
, DYNAMIC_TIME_ZONE_INFORMATION
*tzinfo
)
387 static const WCHAR Dynamic_DstW
[] = { 'D','y','n','a','m','i','c',' ','D','S','T',0 };
388 static const WCHAR fmtW
[] = { '%','d',0 };
389 static const WCHAR stdW
[] = { 'S','t','d',0 };
390 static const WCHAR dltW
[] = { 'D','l','t',0 };
391 static const WCHAR tziW
[] = { 'T','Z','I',0 };
392 HANDLE time_zone_key
, dynamic_dst_key
;
393 OBJECT_ATTRIBUTES attr
;
394 UNICODE_STRING nameW
;
396 BOOL got_reg_data
= FALSE
;
406 if (!TIME_GetSpecificTimeZoneKey( key_name
, &time_zone_key
))
409 if (!reg_query_value( time_zone_key
, stdW
, REG_SZ
, tzinfo
->StandardName
, sizeof(tzinfo
->StandardName
)) ||
410 !reg_query_value( time_zone_key
, dltW
, REG_SZ
, tzinfo
->DaylightName
, sizeof(tzinfo
->DaylightName
)))
412 NtClose( time_zone_key
);
416 lstrcpyW(tzinfo
->TimeZoneKeyName
, key_name
);
420 attr
.Length
= sizeof(attr
);
421 attr
.RootDirectory
= time_zone_key
;
422 attr
.ObjectName
= &nameW
;
424 attr
.SecurityDescriptor
= NULL
;
425 attr
.SecurityQualityOfService
= NULL
;
426 RtlInitUnicodeString( &nameW
, Dynamic_DstW
);
427 if (!NtOpenKey( &dynamic_dst_key
, KEY_READ
, &attr
))
429 sprintfW( yearW
, fmtW
, year
);
430 got_reg_data
= reg_query_value( dynamic_dst_key
, yearW
, REG_BINARY
, &tz_data
, sizeof(tz_data
) );
432 NtClose( dynamic_dst_key
);
438 if (!reg_query_value( time_zone_key
, tziW
, REG_BINARY
, &tz_data
, sizeof(tz_data
) ))
440 NtClose( time_zone_key
);
445 tzinfo
->Bias
= tz_data
.bias
;
446 tzinfo
->StandardBias
= tz_data
.std_bias
;
447 tzinfo
->DaylightBias
= tz_data
.dlt_bias
;
448 tzinfo
->StandardDate
= tz_data
.std_date
;
449 tzinfo
->DaylightDate
= tz_data
.dlt_date
;
451 tzinfo
->DynamicDaylightTimeDisabled
= !dynamic
;
453 NtClose( time_zone_key
);
459 /***********************************************************************
460 * SetLocalTime (KERNEL32.@)
462 * Set the local time using current time zone and daylight
466 * systime [in] The desired local time.
469 * Success: TRUE. The time was set.
470 * Failure: FALSE, if the time was invalid or caller does not have
471 * permission to change the time.
473 BOOL WINAPI
SetLocalTime( const SYSTEMTIME
*systime
)
476 LARGE_INTEGER st
, st2
;
479 if( !SystemTimeToFileTime( systime
, &ft
))
481 st
.u
.LowPart
= ft
.dwLowDateTime
;
482 st
.u
.HighPart
= ft
.dwHighDateTime
;
483 RtlLocalTimeToSystemTime( &st
, &st2
);
485 if ((status
= NtSetSystemTime(&st2
, NULL
)))
486 SetLastError( RtlNtStatusToDosError(status
) );
491 /***********************************************************************
492 * GetSystemTimeAdjustment (KERNEL32.@)
494 * Get the period between clock interrupts and the amount the clock
495 * is adjusted each interrupt so as to keep it in sync with an external source.
498 * lpTimeAdjustment [out] The clock adjustment per interrupt in 100's of nanoseconds.
499 * lpTimeIncrement [out] The time between clock interrupts in 100's of nanoseconds.
500 * lpTimeAdjustmentDisabled [out] The clock synchronisation has been disabled.
506 * Only the special case of disabled time adjustments is supported.
508 BOOL WINAPI
GetSystemTimeAdjustment( PDWORD lpTimeAdjustment
, PDWORD lpTimeIncrement
,
509 PBOOL lpTimeAdjustmentDisabled
)
511 *lpTimeAdjustment
= 0;
512 *lpTimeIncrement
= 10000000 / sysconf(_SC_CLK_TCK
);
513 *lpTimeAdjustmentDisabled
= TRUE
;
518 /***********************************************************************
519 * SetSystemTime (KERNEL32.@)
521 * Set the system time in utc.
524 * systime [in] The desired system time.
527 * Success: TRUE. The time was set.
528 * Failure: FALSE, if the time was invalid or caller does not have
529 * permission to change the time.
531 BOOL WINAPI
SetSystemTime( const SYSTEMTIME
*systime
)
537 if( !SystemTimeToFileTime( systime
, &ft
))
539 t
.u
.LowPart
= ft
.dwLowDateTime
;
540 t
.u
.HighPart
= ft
.dwHighDateTime
;
541 if ((status
= NtSetSystemTime(&t
, NULL
)))
542 SetLastError( RtlNtStatusToDosError(status
) );
546 /***********************************************************************
547 * SetSystemTimeAdjustment (KERNEL32.@)
549 * Enables or disables the timing adjustments to the system's clock.
552 * dwTimeAdjustment [in] Number of units to add per clock interrupt.
553 * bTimeAdjustmentDisabled [in] Adjustment mode.
559 BOOL WINAPI
SetSystemTimeAdjustment( DWORD dwTimeAdjustment
, BOOL bTimeAdjustmentDisabled
)
561 /* Fake function for now... */
562 FIXME("(%08x,%d): stub !\n", dwTimeAdjustment
, bTimeAdjustmentDisabled
);
566 /***********************************************************************
567 * GetTimeZoneInformation (KERNEL32.@)
569 * Get information about the current local time zone.
572 * tzinfo [out] Destination for time zone information.
575 * TIME_ZONE_ID_INVALID An error occurred
576 * TIME_ZONE_ID_UNKNOWN There are no transition time known
577 * TIME_ZONE_ID_STANDARD Current time is standard time
578 * TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time
580 DWORD WINAPI
GetTimeZoneInformation( LPTIME_ZONE_INFORMATION tzinfo
)
584 status
= RtlQueryTimeZoneInformation( (RTL_TIME_ZONE_INFORMATION
*)tzinfo
);
585 if ( status
!= STATUS_SUCCESS
)
587 SetLastError( RtlNtStatusToDosError(status
) );
588 return TIME_ZONE_ID_INVALID
;
590 return TIME_ZoneID( tzinfo
);
593 /***********************************************************************
594 * GetTimeZoneInformationForYear (KERNEL32.@)
596 BOOL WINAPI
GetTimeZoneInformationForYear( USHORT wYear
,
597 PDYNAMIC_TIME_ZONE_INFORMATION pdtzi
, LPTIME_ZONE_INFORMATION ptzi
)
599 DYNAMIC_TIME_ZONE_INFORMATION local_dtzi
, result
;
603 if (GetDynamicTimeZoneInformation(&local_dtzi
) == TIME_ZONE_ID_INVALID
)
608 if (!TIME_GetSpecificTimeZoneInfo(pdtzi
->TimeZoneKeyName
, wYear
,
609 !pdtzi
->DynamicDaylightTimeDisabled
, &result
))
612 memcpy(ptzi
, &result
, sizeof(*ptzi
));
617 /***********************************************************************
618 * SetTimeZoneInformation (KERNEL32.@)
620 * Change the settings of the current local time zone.
623 * tzinfo [in] The new time zone.
626 * Success: TRUE. The time zone was updated with the settings from tzinfo.
629 BOOL WINAPI
SetTimeZoneInformation( const TIME_ZONE_INFORMATION
*tzinfo
)
632 status
= RtlSetTimeZoneInformation( (const RTL_TIME_ZONE_INFORMATION
*)tzinfo
);
633 if ( status
!= STATUS_SUCCESS
)
634 SetLastError( RtlNtStatusToDosError(status
) );
638 /***********************************************************************
639 * SystemTimeToTzSpecificLocalTime (KERNEL32.@)
641 * Convert a utc system time to a local time in a given time zone.
644 * lpTimeZoneInformation [in] The desired time zone.
645 * lpUniversalTime [in] The utc time to base local time on.
646 * lpLocalTime [out] The local time in the time zone.
649 * Success: TRUE. lpLocalTime contains the converted time
653 BOOL WINAPI
SystemTimeToTzSpecificLocalTime(
654 const TIME_ZONE_INFORMATION
*lpTimeZoneInformation
,
655 const SYSTEMTIME
*lpUniversalTime
, LPSYSTEMTIME lpLocalTime
)
660 TIME_ZONE_INFORMATION tzinfo
;
662 if (lpTimeZoneInformation
!= NULL
)
664 tzinfo
= *lpTimeZoneInformation
;
668 if (GetTimeZoneInformation(&tzinfo
) == TIME_ZONE_ID_INVALID
)
672 if (!SystemTimeToFileTime(lpUniversalTime
, &ft
))
674 FILETIME2LL( &ft
, llTime
)
675 if (!TIME_GetTimezoneBias(&tzinfo
, &ft
, FALSE
, &lBias
))
677 /* convert minutes to 100-nanoseconds-ticks */
678 llTime
-= (LONGLONG
)lBias
* 600000000;
679 LL2FILETIME( llTime
, &ft
)
681 return FileTimeToSystemTime(&ft
, lpLocalTime
);
685 /***********************************************************************
686 * TzSpecificLocalTimeToSystemTime (KERNEL32.@)
688 * Converts a local time to a time in utc.
691 * lpTimeZoneInformation [in] The desired time zone.
692 * lpLocalTime [in] The local time.
693 * lpUniversalTime [out] The calculated utc time.
696 * Success: TRUE. lpUniversalTime contains the converted time.
699 BOOL WINAPI
TzSpecificLocalTimeToSystemTime(
700 const TIME_ZONE_INFORMATION
*lpTimeZoneInformation
,
701 const SYSTEMTIME
*lpLocalTime
, LPSYSTEMTIME lpUniversalTime
)
706 TIME_ZONE_INFORMATION tzinfo
;
708 if (lpTimeZoneInformation
!= NULL
)
710 tzinfo
= *lpTimeZoneInformation
;
714 if (GetTimeZoneInformation(&tzinfo
) == TIME_ZONE_ID_INVALID
)
718 if (!SystemTimeToFileTime(lpLocalTime
, &ft
))
721 if (!TIME_GetTimezoneBias(&tzinfo
, &ft
, TRUE
, &lBias
))
723 /* convert minutes to 100-nanoseconds-ticks */
724 t
+= (LONGLONG
)lBias
* 600000000;
726 return FileTimeToSystemTime(&ft
, lpUniversalTime
);
730 /***********************************************************************
731 * GetSystemTimeAsFileTime (KERNEL32.@)
733 * Get the current time in utc format.
738 VOID WINAPI
GetSystemTimeAsFileTime(
739 LPFILETIME time
) /* [out] Destination for the current utc time */
742 NtQuerySystemTime( &t
);
743 time
->dwLowDateTime
= t
.u
.LowPart
;
744 time
->dwHighDateTime
= t
.u
.HighPart
;
748 /***********************************************************************
749 * GetSystemTimePreciseAsFileTime (KERNEL32.@)
751 * Get the current time in utc format, with <1 us precision.
756 VOID WINAPI
GetSystemTimePreciseAsFileTime(
757 LPFILETIME time
) /* [out] Destination for the current utc time */
759 GetSystemTimeAsFileTime(time
);
763 /*********************************************************************
764 * TIME_ClockTimeToFileTime (olorin@fandra.org, 20-Sep-1998)
766 * Used by GetProcessTimes to convert clock_t into FILETIME.
768 * Differences to UnixTimeToFileTime:
769 * 1) Divided by CLK_TCK
770 * 2) Time is relative. There is no 'starting date', so there is
771 * no need for offset correction, like in UnixTimeToFileTime
773 static void TIME_ClockTimeToFileTime(clock_t unix_time
, LPFILETIME filetime
)
775 long clocksPerSec
= sysconf(_SC_CLK_TCK
);
776 ULONGLONG secs
= (ULONGLONG
)unix_time
* 10000000 / clocksPerSec
;
777 filetime
->dwLowDateTime
= (DWORD
)secs
;
778 filetime
->dwHighDateTime
= (DWORD
)(secs
>> 32);
781 /***********************************************************************
782 * TIMEZONE_InitRegistry
784 * Update registry contents on startup if the user timezone has changed.
785 * This simulates the action of the Windows control panel.
787 void TIMEZONE_InitRegistry(void)
789 static const WCHAR timezoneInformationW
[] = {
790 'M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\',
791 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
792 'C','o','n','t','r','o','l','\\',
793 'T','i','m','e','Z','o','n','e','I','n','f','o','r','m','a','t','i','o','n','\0'
795 static const WCHAR standardNameW
[] = {'S','t','a','n','d','a','r','d','N','a','m','e','\0'};
796 static const WCHAR timezoneKeyNameW
[] = {'T','i','m','e','Z','o','n','e','K','e','y','N','a','m','e','\0'};
797 DYNAMIC_TIME_ZONE_INFORMATION tzinfo
;
799 OBJECT_ATTRIBUTES attr
;
803 tzid
= GetDynamicTimeZoneInformation(&tzinfo
);
804 if (tzid
== TIME_ZONE_ID_INVALID
) return;
806 RtlInitUnicodeString(&name
, timezoneInformationW
);
807 InitializeObjectAttributes(&attr
, &name
, 0, 0, NULL
);
808 if (NtCreateKey(&hkey
, KEY_ALL_ACCESS
, &attr
, 0, NULL
, 0, NULL
) != STATUS_SUCCESS
) return;
810 RtlInitUnicodeString(&name
, standardNameW
);
811 NtSetValueKey(hkey
, &name
, 0, REG_SZ
, tzinfo
.StandardName
,
812 (strlenW(tzinfo
.StandardName
) + 1) * sizeof(WCHAR
));
814 RtlInitUnicodeString(&name
, timezoneKeyNameW
);
815 NtSetValueKey(hkey
, &name
, 0, REG_SZ
, tzinfo
.TimeZoneKeyName
,
816 (strlenW(tzinfo
.TimeZoneKeyName
) + 1) * sizeof(WCHAR
));
821 /*********************************************************************
822 * GetProcessTimes (KERNEL32.@)
824 * Get the user and kernel execution times of a process,
825 * along with the creation and exit times if known.
828 * hprocess [in] The process to be queried.
829 * lpCreationTime [out] The creation time of the process.
830 * lpExitTime [out] The exit time of the process if exited.
831 * lpKernelTime [out] The time spent in kernel routines in 100's of nanoseconds.
832 * lpUserTime [out] The time spent in user routines in 100's of nanoseconds.
839 * Would be nice to subtract the cpu time used by Wine at startup.
840 * Also, there is a need to separate times used by different applications.
843 * KernelTime and UserTime are always for the current process
845 BOOL WINAPI
GetProcessTimes( HANDLE hprocess
, LPFILETIME lpCreationTime
,
846 LPFILETIME lpExitTime
, LPFILETIME lpKernelTime
, LPFILETIME lpUserTime
)
849 KERNEL_USER_TIMES pti
;
852 TIME_ClockTimeToFileTime(tms
.tms_utime
,lpUserTime
);
853 TIME_ClockTimeToFileTime(tms
.tms_stime
,lpKernelTime
);
854 if (NtQueryInformationProcess( hprocess
, ProcessTimes
, &pti
, sizeof(pti
), NULL
))
856 LL2FILETIME( pti
.CreateTime
.QuadPart
, lpCreationTime
);
857 LL2FILETIME( pti
.ExitTime
.QuadPart
, lpExitTime
);
861 /*********************************************************************
862 * GetCalendarInfoA (KERNEL32.@)
865 int WINAPI
GetCalendarInfoA(LCID lcid
, CALID Calendar
, CALTYPE CalType
,
866 LPSTR lpCalData
, int cchData
, LPDWORD lpValue
)
868 int ret
, cchDataW
= cchData
;
869 LPWSTR lpCalDataW
= NULL
;
871 if (NLS_IsUnicodeOnlyLcid(lcid
))
873 SetLastError(ERROR_INVALID_PARAMETER
);
877 if (!cchData
&& !(CalType
& CAL_RETURN_NUMBER
))
878 cchDataW
= GetCalendarInfoW(lcid
, Calendar
, CalType
, NULL
, 0, NULL
);
879 if (!(lpCalDataW
= HeapAlloc(GetProcessHeap(), 0, cchDataW
*sizeof(WCHAR
))))
882 ret
= GetCalendarInfoW(lcid
, Calendar
, CalType
, lpCalDataW
, cchDataW
, lpValue
);
883 if(ret
&& lpCalDataW
&& lpCalData
)
884 ret
= WideCharToMultiByte(CP_ACP
, 0, lpCalDataW
, -1, lpCalData
, cchData
, NULL
, NULL
);
885 else if (CalType
& CAL_RETURN_NUMBER
)
886 ret
*= sizeof(WCHAR
);
887 HeapFree(GetProcessHeap(), 0, lpCalDataW
);
892 /*********************************************************************
893 * GetCalendarInfoW (KERNEL32.@)
896 int WINAPI
GetCalendarInfoW(LCID Locale
, CALID Calendar
, CALTYPE CalType
,
897 LPWSTR lpCalData
, int cchData
, LPDWORD lpValue
)
899 static const LCTYPE caltype_lctype_map
[] = {
901 0, /* CAL_ICALINTVALUE */
902 0, /* CAL_SCALNAME */
903 0, /* CAL_IYEAROFFSETRANGE */
904 0, /* CAL_SERASTRING */
914 LOCALE_SABBREVDAYNAME1
,
915 LOCALE_SABBREVDAYNAME2
,
916 LOCALE_SABBREVDAYNAME3
,
917 LOCALE_SABBREVDAYNAME4
,
918 LOCALE_SABBREVDAYNAME5
,
919 LOCALE_SABBREVDAYNAME6
,
920 LOCALE_SABBREVDAYNAME7
,
934 LOCALE_SABBREVMONTHNAME1
,
935 LOCALE_SABBREVMONTHNAME2
,
936 LOCALE_SABBREVMONTHNAME3
,
937 LOCALE_SABBREVMONTHNAME4
,
938 LOCALE_SABBREVMONTHNAME5
,
939 LOCALE_SABBREVMONTHNAME6
,
940 LOCALE_SABBREVMONTHNAME7
,
941 LOCALE_SABBREVMONTHNAME8
,
942 LOCALE_SABBREVMONTHNAME9
,
943 LOCALE_SABBREVMONTHNAME10
,
944 LOCALE_SABBREVMONTHNAME11
,
945 LOCALE_SABBREVMONTHNAME12
,
946 LOCALE_SABBREVMONTHNAME13
,
948 0, /* CAL_ITWODIGITYEARMAX */
949 LOCALE_SSHORTESTDAYNAME1
,
950 LOCALE_SSHORTESTDAYNAME2
,
951 LOCALE_SSHORTESTDAYNAME3
,
952 LOCALE_SSHORTESTDAYNAME4
,
953 LOCALE_SSHORTESTDAYNAME5
,
954 LOCALE_SSHORTESTDAYNAME6
,
955 LOCALE_SSHORTESTDAYNAME7
,
957 0, /* CAL_SABBREVERASTRING */
959 DWORD localeflags
= 0;
962 if (CalType
& CAL_NOUSEROVERRIDE
)
963 FIXME("flag CAL_NOUSEROVERRIDE used, not fully implemented\n");
964 if (CalType
& CAL_USE_CP_ACP
)
965 FIXME("flag CAL_USE_CP_ACP used, not fully implemented\n");
967 if (CalType
& CAL_RETURN_NUMBER
) {
970 SetLastError( ERROR_INVALID_PARAMETER
);
973 if (lpCalData
!= NULL
)
974 WARN("lpCalData not NULL (%p) when it should!\n", lpCalData
);
976 WARN("cchData not 0 (%d) when it should!\n", cchData
);
979 WARN("lpValue not NULL (%p) when it should!\n", lpValue
);
982 /* FIXME: No verification is made yet wrt Locale
983 * for the CALTYPES not requiring GetLocaleInfoA */
985 calinfo
= CalType
& 0xffff;
987 if (CalType
& CAL_RETURN_GENITIVE_NAMES
)
988 localeflags
|= LOCALE_RETURN_GENITIVE_NAMES
;
991 case CAL_ICALINTVALUE
:
992 if (CalType
& CAL_RETURN_NUMBER
)
993 return GetLocaleInfoW(Locale
, LOCALE_RETURN_NUMBER
| LOCALE_ICALENDARTYPE
,
995 return GetLocaleInfoW(Locale
, LOCALE_ICALENDARTYPE
, lpCalData
, cchData
);
997 FIXME("Unimplemented caltype %d\n", calinfo
);
998 if (lpCalData
) *lpCalData
= 0;
1000 case CAL_IYEAROFFSETRANGE
:
1001 FIXME("Unimplemented caltype %d\n", calinfo
);
1003 case CAL_SERASTRING
:
1004 FIXME("Unimplemented caltype %d\n", calinfo
);
1006 case CAL_SSHORTDATE
:
1015 case CAL_SABBREVDAYNAME1
:
1016 case CAL_SABBREVDAYNAME2
:
1017 case CAL_SABBREVDAYNAME3
:
1018 case CAL_SABBREVDAYNAME4
:
1019 case CAL_SABBREVDAYNAME5
:
1020 case CAL_SABBREVDAYNAME6
:
1021 case CAL_SABBREVDAYNAME7
:
1022 case CAL_SMONTHNAME1
:
1023 case CAL_SMONTHNAME2
:
1024 case CAL_SMONTHNAME3
:
1025 case CAL_SMONTHNAME4
:
1026 case CAL_SMONTHNAME5
:
1027 case CAL_SMONTHNAME6
:
1028 case CAL_SMONTHNAME7
:
1029 case CAL_SMONTHNAME8
:
1030 case CAL_SMONTHNAME9
:
1031 case CAL_SMONTHNAME10
:
1032 case CAL_SMONTHNAME11
:
1033 case CAL_SMONTHNAME12
:
1034 case CAL_SMONTHNAME13
:
1035 case CAL_SABBREVMONTHNAME1
:
1036 case CAL_SABBREVMONTHNAME2
:
1037 case CAL_SABBREVMONTHNAME3
:
1038 case CAL_SABBREVMONTHNAME4
:
1039 case CAL_SABBREVMONTHNAME5
:
1040 case CAL_SABBREVMONTHNAME6
:
1041 case CAL_SABBREVMONTHNAME7
:
1042 case CAL_SABBREVMONTHNAME8
:
1043 case CAL_SABBREVMONTHNAME9
:
1044 case CAL_SABBREVMONTHNAME10
:
1045 case CAL_SABBREVMONTHNAME11
:
1046 case CAL_SABBREVMONTHNAME12
:
1047 case CAL_SABBREVMONTHNAME13
:
1048 case CAL_SYEARMONTH
:
1049 return GetLocaleInfoW(Locale
, caltype_lctype_map
[calinfo
] | localeflags
, lpCalData
, cchData
);
1050 case CAL_ITWODIGITYEARMAX
:
1051 if (CalType
& CAL_RETURN_NUMBER
)
1053 *lpValue
= CALINFO_MAX_YEAR
;
1054 return sizeof(DWORD
) / sizeof(WCHAR
);
1058 static const WCHAR fmtW
[] = {'%','u',0};
1060 int ret
= snprintfW( buffer
, 10, fmtW
, CALINFO_MAX_YEAR
) + 1;
1061 if (!lpCalData
) return ret
;
1064 strcpyW( lpCalData
, buffer
);
1067 SetLastError( ERROR_INSUFFICIENT_BUFFER
);
1072 FIXME("Unknown caltype %d\n", calinfo
);
1073 SetLastError(ERROR_INVALID_FLAGS
);
1079 /*********************************************************************
1080 * GetCalendarInfoEx (KERNEL32.@)
1082 int WINAPI
GetCalendarInfoEx(LPCWSTR locale
, CALID calendar
, LPCWSTR lpReserved
, CALTYPE caltype
,
1083 LPWSTR data
, int len
, DWORD
*value
)
1087 LCID lcid
= LocaleNameToLCID(locale
, 0);
1089 FIXME("(%s, %d, %p, 0x%08x, %p, %d, %p): semi-stub\n", debugstr_w(locale
), calendar
, lpReserved
, caltype
,
1091 return GetCalendarInfoW(lcid
, calendar
, caltype
, data
, len
, value
);
1094 /*********************************************************************
1095 * SetCalendarInfoA (KERNEL32.@)
1098 int WINAPI
SetCalendarInfoA(LCID Locale
, CALID Calendar
, CALTYPE CalType
, LPCSTR lpCalData
)
1100 FIXME("(%08x,%08x,%08x,%s): stub\n",
1101 Locale
, Calendar
, CalType
, debugstr_a(lpCalData
));
1105 /*********************************************************************
1106 * SetCalendarInfoW (KERNEL32.@)
1110 int WINAPI
SetCalendarInfoW(LCID Locale
, CALID Calendar
, CALTYPE CalType
, LPCWSTR lpCalData
)
1112 FIXME("(%08x,%08x,%08x,%s): stub\n",
1113 Locale
, Calendar
, CalType
, debugstr_w(lpCalData
));
1117 /*********************************************************************
1118 * LocalFileTimeToFileTime (KERNEL32.@)
1120 BOOL WINAPI
LocalFileTimeToFileTime( const FILETIME
*localft
, LPFILETIME utcft
)
1123 LARGE_INTEGER local
, utc
;
1125 local
.u
.LowPart
= localft
->dwLowDateTime
;
1126 local
.u
.HighPart
= localft
->dwHighDateTime
;
1127 if (!(status
= RtlLocalTimeToSystemTime( &local
, &utc
)))
1129 utcft
->dwLowDateTime
= utc
.u
.LowPart
;
1130 utcft
->dwHighDateTime
= utc
.u
.HighPart
;
1132 else SetLastError( RtlNtStatusToDosError(status
) );
1137 /*********************************************************************
1138 * FileTimeToLocalFileTime (KERNEL32.@)
1140 BOOL WINAPI
FileTimeToLocalFileTime( const FILETIME
*utcft
, LPFILETIME localft
)
1143 LARGE_INTEGER local
, utc
;
1145 utc
.u
.LowPart
= utcft
->dwLowDateTime
;
1146 utc
.u
.HighPart
= utcft
->dwHighDateTime
;
1147 if (!(status
= RtlSystemTimeToLocalTime( &utc
, &local
)))
1149 localft
->dwLowDateTime
= local
.u
.LowPart
;
1150 localft
->dwHighDateTime
= local
.u
.HighPart
;
1152 else SetLastError( RtlNtStatusToDosError(status
) );
1157 /*********************************************************************
1158 * FileTimeToSystemTime (KERNEL32.@)
1160 BOOL WINAPI
FileTimeToSystemTime( const FILETIME
*ft
, LPSYSTEMTIME syst
)
1165 t
.u
.LowPart
= ft
->dwLowDateTime
;
1166 t
.u
.HighPart
= ft
->dwHighDateTime
;
1167 RtlTimeToTimeFields(&t
, &tf
);
1169 syst
->wYear
= tf
.Year
;
1170 syst
->wMonth
= tf
.Month
;
1171 syst
->wDay
= tf
.Day
;
1172 syst
->wHour
= tf
.Hour
;
1173 syst
->wMinute
= tf
.Minute
;
1174 syst
->wSecond
= tf
.Second
;
1175 syst
->wMilliseconds
= tf
.Milliseconds
;
1176 syst
->wDayOfWeek
= tf
.Weekday
;
1180 /*********************************************************************
1181 * SystemTimeToFileTime (KERNEL32.@)
1183 BOOL WINAPI
SystemTimeToFileTime( const SYSTEMTIME
*syst
, LPFILETIME ft
)
1188 tf
.Year
= syst
->wYear
;
1189 tf
.Month
= syst
->wMonth
;
1190 tf
.Day
= syst
->wDay
;
1191 tf
.Hour
= syst
->wHour
;
1192 tf
.Minute
= syst
->wMinute
;
1193 tf
.Second
= syst
->wSecond
;
1194 tf
.Milliseconds
= syst
->wMilliseconds
;
1196 if( !RtlTimeFieldsToTime(&tf
, &t
)) {
1197 SetLastError( ERROR_INVALID_PARAMETER
);
1200 ft
->dwLowDateTime
= t
.u
.LowPart
;
1201 ft
->dwHighDateTime
= t
.u
.HighPart
;
1205 /*********************************************************************
1206 * CompareFileTime (KERNEL32.@)
1208 * Compare two FILETIME's to each other.
1212 * y [I] time to compare to x
1215 * -1, 0, or 1 indicating that x is less than, equal to, or greater
1216 * than y respectively.
1218 INT WINAPI
CompareFileTime( const FILETIME
*x
, const FILETIME
*y
)
1220 if (!x
|| !y
) return -1;
1222 if (x
->dwHighDateTime
> y
->dwHighDateTime
)
1224 if (x
->dwHighDateTime
< y
->dwHighDateTime
)
1226 if (x
->dwLowDateTime
> y
->dwLowDateTime
)
1228 if (x
->dwLowDateTime
< y
->dwLowDateTime
)
1233 /*********************************************************************
1234 * GetLocalTime (KERNEL32.@)
1236 * Get the current local time.
1239 * systime [O] Destination for current time.
1244 VOID WINAPI
GetLocalTime(LPSYSTEMTIME systime
)
1247 LARGE_INTEGER ft
, ft2
;
1249 NtQuerySystemTime(&ft
);
1250 RtlSystemTimeToLocalTime(&ft
, &ft2
);
1251 lft
.dwLowDateTime
= ft2
.u
.LowPart
;
1252 lft
.dwHighDateTime
= ft2
.u
.HighPart
;
1253 FileTimeToSystemTime(&lft
, systime
);
1256 /*********************************************************************
1257 * GetSystemTime (KERNEL32.@)
1259 * Get the current system time.
1262 * systime [O] Destination for current time.
1267 VOID WINAPI
GetSystemTime(LPSYSTEMTIME systime
)
1272 NtQuerySystemTime(&t
);
1273 ft
.dwLowDateTime
= t
.u
.LowPart
;
1274 ft
.dwHighDateTime
= t
.u
.HighPart
;
1275 FileTimeToSystemTime(&ft
, systime
);
1278 /*********************************************************************
1279 * GetDaylightFlag (KERNEL32.@)
1281 * Specifies if daylight savings time is in operation.
1284 * This function is called from the Win98's control applet timedate.cpl.
1287 * TRUE if daylight savings time is in operation.
1290 BOOL WINAPI
GetDaylightFlag(void)
1292 TIME_ZONE_INFORMATION tzinfo
;
1293 return GetTimeZoneInformation( &tzinfo
) == TIME_ZONE_ID_DAYLIGHT
;
1296 /***********************************************************************
1297 * DosDateTimeToFileTime (KERNEL32.@)
1299 BOOL WINAPI
DosDateTimeToFileTime( WORD fatdate
, WORD fattime
, LPFILETIME ft
)
1304 time_t time1
, time2
;
1307 newtm
.tm_sec
= (fattime
& 0x1f) * 2;
1308 newtm
.tm_min
= (fattime
>> 5) & 0x3f;
1309 newtm
.tm_hour
= (fattime
>> 11);
1310 newtm
.tm_mday
= (fatdate
& 0x1f);
1311 newtm
.tm_mon
= ((fatdate
>> 5) & 0x0f) - 1;
1312 newtm
.tm_year
= (fatdate
>> 9) + 80;
1313 newtm
.tm_isdst
= -1;
1315 RtlSecondsSince1970ToTime( timegm(&newtm
), (LARGE_INTEGER
*)ft
);
1317 time1
= mktime(&newtm
);
1318 gtm
= gmtime(&time1
);
1319 time2
= mktime(gtm
);
1320 RtlSecondsSince1970ToTime( 2*time1
-time2
, (LARGE_INTEGER
*)ft
);
1326 /***********************************************************************
1327 * FileTimeToDosDateTime (KERNEL32.@)
1329 BOOL WINAPI
FileTimeToDosDateTime( const FILETIME
*ft
, LPWORD fatdate
,
1337 if (!fatdate
|| !fattime
)
1339 SetLastError(ERROR_INVALID_PARAMETER
);
1342 li
.u
.LowPart
= ft
->dwLowDateTime
;
1343 li
.u
.HighPart
= ft
->dwHighDateTime
;
1344 if (!RtlTimeToSecondsSince1970( &li
, &t
))
1346 SetLastError(ERROR_INVALID_PARAMETER
);
1350 tm
= gmtime( &unixtime
);
1351 *fattime
= (tm
->tm_hour
<< 11) + (tm
->tm_min
<< 5) + (tm
->tm_sec
/ 2);
1352 *fatdate
= ((tm
->tm_year
- 80) << 9) + ((tm
->tm_mon
+ 1) << 5) + tm
->tm_mday
;
1356 /*********************************************************************
1357 * GetSystemTimes (KERNEL32.@)
1359 * Retrieves system timing information
1362 * lpIdleTime [O] Destination for idle time.
1363 * lpKernelTime [O] Destination for kernel time.
1364 * lpUserTime [O] Destination for user time.
1367 * TRUE if success, FALSE otherwise.
1369 BOOL WINAPI
GetSystemTimes(LPFILETIME lpIdleTime
, LPFILETIME lpKernelTime
, LPFILETIME lpUserTime
)
1371 LARGE_INTEGER idle_time
, kernel_time
, user_time
;
1372 SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
*sppi
;
1373 SYSTEM_BASIC_INFORMATION sbi
;
1378 TRACE("(%p,%p,%p)\n", lpIdleTime
, lpKernelTime
, lpUserTime
);
1380 status
= NtQuerySystemInformation( SystemBasicInformation
, &sbi
, sizeof(sbi
), &ret_size
);
1381 if (status
!= STATUS_SUCCESS
)
1383 SetLastError( RtlNtStatusToDosError(status
) );
1387 sppi
= HeapAlloc( GetProcessHeap(), 0,
1388 sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
) * sbi
.NumberOfProcessors
);
1391 SetLastError( ERROR_OUTOFMEMORY
);
1395 status
= NtQuerySystemInformation( SystemProcessorPerformanceInformation
, sppi
, sizeof(*sppi
) * sbi
.NumberOfProcessors
,
1397 if (status
!= STATUS_SUCCESS
)
1399 HeapFree( GetProcessHeap(), 0, sppi
);
1400 SetLastError( RtlNtStatusToDosError(status
) );
1404 idle_time
.QuadPart
= 0;
1405 kernel_time
.QuadPart
= 0;
1406 user_time
.QuadPart
= 0;
1407 for (i
= 0; i
< sbi
.NumberOfProcessors
; i
++)
1409 idle_time
.QuadPart
+= sppi
[i
].IdleTime
.QuadPart
;
1410 kernel_time
.QuadPart
+= sppi
[i
].KernelTime
.QuadPart
;
1411 user_time
.QuadPart
+= sppi
[i
].UserTime
.QuadPart
;
1416 lpIdleTime
->dwLowDateTime
= idle_time
.u
.LowPart
;
1417 lpIdleTime
->dwHighDateTime
= idle_time
.u
.HighPart
;
1421 lpKernelTime
->dwLowDateTime
= kernel_time
.u
.LowPart
;
1422 lpKernelTime
->dwHighDateTime
= kernel_time
.u
.HighPart
;
1426 lpUserTime
->dwLowDateTime
= user_time
.u
.LowPart
;
1427 lpUserTime
->dwHighDateTime
= user_time
.u
.HighPart
;
1430 HeapFree( GetProcessHeap(), 0, sppi
);
1434 /***********************************************************************
1435 * GetDynamicTimeZoneInformation (KERNEL32.@)
1437 DWORD WINAPI
GetDynamicTimeZoneInformation(DYNAMIC_TIME_ZONE_INFORMATION
*tzinfo
)
1441 status
= RtlQueryDynamicTimeZoneInformation( (RTL_DYNAMIC_TIME_ZONE_INFORMATION
*)tzinfo
);
1442 if ( status
!= STATUS_SUCCESS
)
1444 SetLastError( RtlNtStatusToDosError(status
) );
1445 return TIME_ZONE_ID_INVALID
;
1447 return TIME_ZoneID( (TIME_ZONE_INFORMATION
*)tzinfo
);
1450 /***********************************************************************
1451 * QueryProcessCycleTime (KERNEL32.@)
1453 BOOL WINAPI
QueryProcessCycleTime(HANDLE process
, PULONG64 cycle
)
1457 FIXME("(%p,%p): stub!\n", process
, cycle
);
1458 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1462 /***********************************************************************
1463 * QueryThreadCycleTime (KERNEL32.@)
1465 BOOL WINAPI
QueryThreadCycleTime(HANDLE thread
, PULONG64 cycle
)
1469 FIXME("(%p,%p): stub!\n", thread
, cycle
);
1470 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1474 /***********************************************************************
1475 * QueryUnbiasedInterruptTime (KERNEL32.@)
1477 BOOL WINAPI
QueryUnbiasedInterruptTime(ULONGLONG
*time
)
1479 TRACE("(%p)\n", time
);
1480 if (!time
) return FALSE
;
1481 RtlQueryUnbiasedInterruptTime(time
);