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 * GetProcessTimes (KERNEL32.@)
784 * Get the user and kernel execution times of a process,
785 * along with the creation and exit times if known.
788 * hprocess [in] The process to be queried.
789 * lpCreationTime [out] The creation time of the process.
790 * lpExitTime [out] The exit time of the process if exited.
791 * lpKernelTime [out] The time spent in kernel routines in 100's of nanoseconds.
792 * lpUserTime [out] The time spent in user routines in 100's of nanoseconds.
799 * Would be nice to subtract the cpu time used by Wine at startup.
800 * Also, there is a need to separate times used by different applications.
803 * KernelTime and UserTime are always for the current process
805 BOOL WINAPI
GetProcessTimes( HANDLE hprocess
, LPFILETIME lpCreationTime
,
806 LPFILETIME lpExitTime
, LPFILETIME lpKernelTime
, LPFILETIME lpUserTime
)
809 KERNEL_USER_TIMES pti
;
812 TIME_ClockTimeToFileTime(tms
.tms_utime
,lpUserTime
);
813 TIME_ClockTimeToFileTime(tms
.tms_stime
,lpKernelTime
);
814 if (NtQueryInformationProcess( hprocess
, ProcessTimes
, &pti
, sizeof(pti
), NULL
))
816 LL2FILETIME( pti
.CreateTime
.QuadPart
, lpCreationTime
);
817 LL2FILETIME( pti
.ExitTime
.QuadPart
, lpExitTime
);
821 /*********************************************************************
822 * GetCalendarInfoA (KERNEL32.@)
825 int WINAPI
GetCalendarInfoA(LCID lcid
, CALID Calendar
, CALTYPE CalType
,
826 LPSTR lpCalData
, int cchData
, LPDWORD lpValue
)
828 int ret
, cchDataW
= cchData
;
829 LPWSTR lpCalDataW
= NULL
;
831 if (NLS_IsUnicodeOnlyLcid(lcid
))
833 SetLastError(ERROR_INVALID_PARAMETER
);
837 if (!cchData
&& !(CalType
& CAL_RETURN_NUMBER
))
838 cchDataW
= GetCalendarInfoW(lcid
, Calendar
, CalType
, NULL
, 0, NULL
);
839 if (!(lpCalDataW
= HeapAlloc(GetProcessHeap(), 0, cchDataW
*sizeof(WCHAR
))))
842 ret
= GetCalendarInfoW(lcid
, Calendar
, CalType
, lpCalDataW
, cchDataW
, lpValue
);
843 if(ret
&& lpCalDataW
&& lpCalData
)
844 ret
= WideCharToMultiByte(CP_ACP
, 0, lpCalDataW
, -1, lpCalData
, cchData
, NULL
, NULL
);
845 else if (CalType
& CAL_RETURN_NUMBER
)
846 ret
*= sizeof(WCHAR
);
847 HeapFree(GetProcessHeap(), 0, lpCalDataW
);
852 /*********************************************************************
853 * GetCalendarInfoW (KERNEL32.@)
856 int WINAPI
GetCalendarInfoW(LCID Locale
, CALID Calendar
, CALTYPE CalType
,
857 LPWSTR lpCalData
, int cchData
, LPDWORD lpValue
)
859 if (CalType
& CAL_NOUSEROVERRIDE
)
860 FIXME("flag CAL_NOUSEROVERRIDE used, not fully implemented\n");
861 if (CalType
& CAL_USE_CP_ACP
)
862 FIXME("flag CAL_USE_CP_ACP used, not fully implemented\n");
864 if (CalType
& CAL_RETURN_NUMBER
) {
867 SetLastError( ERROR_INVALID_PARAMETER
);
870 if (lpCalData
!= NULL
)
871 WARN("lpCalData not NULL (%p) when it should!\n", lpCalData
);
873 WARN("cchData not 0 (%d) when it should!\n", cchData
);
876 WARN("lpValue not NULL (%p) when it should!\n", lpValue
);
879 /* FIXME: No verification is made yet wrt Locale
880 * for the CALTYPES not requiring GetLocaleInfoA */
881 switch (CalType
& ~(CAL_NOUSEROVERRIDE
|CAL_RETURN_NUMBER
|CAL_USE_CP_ACP
)) {
882 case CAL_ICALINTVALUE
:
883 if (CalType
& CAL_RETURN_NUMBER
)
884 return GetLocaleInfoW(Locale
, LOCALE_RETURN_NUMBER
| LOCALE_ICALENDARTYPE
,
886 return GetLocaleInfoW(Locale
, LOCALE_ICALENDARTYPE
, lpCalData
, cchData
);
888 FIXME("Unimplemented caltype %d\n", CalType
& 0xffff);
889 if (lpCalData
) *lpCalData
= 0;
891 case CAL_IYEAROFFSETRANGE
:
892 FIXME("Unimplemented caltype %d\n", CalType
& 0xffff);
895 FIXME("Unimplemented caltype %d\n", CalType
& 0xffff);
898 return GetLocaleInfoW(Locale
, LOCALE_SSHORTDATE
, lpCalData
, cchData
);
900 return GetLocaleInfoW(Locale
, LOCALE_SLONGDATE
, lpCalData
, cchData
);
902 return GetLocaleInfoW(Locale
, LOCALE_SDAYNAME1
, lpCalData
, cchData
);
904 return GetLocaleInfoW(Locale
, LOCALE_SDAYNAME2
, lpCalData
, cchData
);
906 return GetLocaleInfoW(Locale
, LOCALE_SDAYNAME3
, lpCalData
, cchData
);
908 return GetLocaleInfoW(Locale
, LOCALE_SDAYNAME4
, lpCalData
, cchData
);
910 return GetLocaleInfoW(Locale
, LOCALE_SDAYNAME5
, lpCalData
, cchData
);
912 return GetLocaleInfoW(Locale
, LOCALE_SDAYNAME6
, lpCalData
, cchData
);
914 return GetLocaleInfoW(Locale
, LOCALE_SDAYNAME7
, lpCalData
, cchData
);
915 case CAL_SABBREVDAYNAME1
:
916 return GetLocaleInfoW(Locale
, LOCALE_SABBREVDAYNAME1
, lpCalData
, cchData
);
917 case CAL_SABBREVDAYNAME2
:
918 return GetLocaleInfoW(Locale
, LOCALE_SABBREVDAYNAME2
, lpCalData
, cchData
);
919 case CAL_SABBREVDAYNAME3
:
920 return GetLocaleInfoW(Locale
, LOCALE_SABBREVDAYNAME3
, lpCalData
, cchData
);
921 case CAL_SABBREVDAYNAME4
:
922 return GetLocaleInfoW(Locale
, LOCALE_SABBREVDAYNAME4
, lpCalData
, cchData
);
923 case CAL_SABBREVDAYNAME5
:
924 return GetLocaleInfoW(Locale
, LOCALE_SABBREVDAYNAME5
, lpCalData
, cchData
);
925 case CAL_SABBREVDAYNAME6
:
926 return GetLocaleInfoW(Locale
, LOCALE_SABBREVDAYNAME6
, lpCalData
, cchData
);
927 case CAL_SABBREVDAYNAME7
:
928 return GetLocaleInfoW(Locale
, LOCALE_SABBREVDAYNAME7
, lpCalData
, cchData
);
929 case CAL_SMONTHNAME1
:
930 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME1
, lpCalData
, cchData
);
931 case CAL_SMONTHNAME2
:
932 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME2
, lpCalData
, cchData
);
933 case CAL_SMONTHNAME3
:
934 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME3
, lpCalData
, cchData
);
935 case CAL_SMONTHNAME4
:
936 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME4
, lpCalData
, cchData
);
937 case CAL_SMONTHNAME5
:
938 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME5
, lpCalData
, cchData
);
939 case CAL_SMONTHNAME6
:
940 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME6
, lpCalData
, cchData
);
941 case CAL_SMONTHNAME7
:
942 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME7
, lpCalData
, cchData
);
943 case CAL_SMONTHNAME8
:
944 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME8
, lpCalData
, cchData
);
945 case CAL_SMONTHNAME9
:
946 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME9
, lpCalData
, cchData
);
947 case CAL_SMONTHNAME10
:
948 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME10
, lpCalData
, cchData
);
949 case CAL_SMONTHNAME11
:
950 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME11
, lpCalData
, cchData
);
951 case CAL_SMONTHNAME12
:
952 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME12
, lpCalData
, cchData
);
953 case CAL_SMONTHNAME13
:
954 return GetLocaleInfoW(Locale
, LOCALE_SMONTHNAME13
, lpCalData
, cchData
);
955 case CAL_SABBREVMONTHNAME1
:
956 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME1
, lpCalData
, cchData
);
957 case CAL_SABBREVMONTHNAME2
:
958 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME2
, lpCalData
, cchData
);
959 case CAL_SABBREVMONTHNAME3
:
960 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME3
, lpCalData
, cchData
);
961 case CAL_SABBREVMONTHNAME4
:
962 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME4
, lpCalData
, cchData
);
963 case CAL_SABBREVMONTHNAME5
:
964 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME5
, lpCalData
, cchData
);
965 case CAL_SABBREVMONTHNAME6
:
966 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME6
, lpCalData
, cchData
);
967 case CAL_SABBREVMONTHNAME7
:
968 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME7
, lpCalData
, cchData
);
969 case CAL_SABBREVMONTHNAME8
:
970 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME8
, lpCalData
, cchData
);
971 case CAL_SABBREVMONTHNAME9
:
972 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME9
, lpCalData
, cchData
);
973 case CAL_SABBREVMONTHNAME10
:
974 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME10
, lpCalData
, cchData
);
975 case CAL_SABBREVMONTHNAME11
:
976 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME11
, lpCalData
, cchData
);
977 case CAL_SABBREVMONTHNAME12
:
978 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME12
, lpCalData
, cchData
);
979 case CAL_SABBREVMONTHNAME13
:
980 return GetLocaleInfoW(Locale
, LOCALE_SABBREVMONTHNAME13
, lpCalData
, cchData
);
982 return GetLocaleInfoW(Locale
, LOCALE_SYEARMONTH
, lpCalData
, cchData
);
983 case CAL_ITWODIGITYEARMAX
:
984 if (CalType
& CAL_RETURN_NUMBER
)
986 *lpValue
= CALINFO_MAX_YEAR
;
987 return sizeof(DWORD
) / sizeof(WCHAR
);
991 static const WCHAR fmtW
[] = {'%','u',0};
993 int ret
= snprintfW( buffer
, 10, fmtW
, CALINFO_MAX_YEAR
) + 1;
994 if (!lpCalData
) return ret
;
997 strcpyW( lpCalData
, buffer
);
1000 SetLastError( ERROR_INSUFFICIENT_BUFFER
);
1005 FIXME("Unknown caltype %d\n",CalType
& 0xffff);
1006 SetLastError(ERROR_INVALID_FLAGS
);
1012 /*********************************************************************
1013 * GetCalendarInfoEx (KERNEL32.@)
1015 int WINAPI
GetCalendarInfoEx(LPCWSTR locale
, CALID calendar
, LPCWSTR lpReserved
, CALTYPE caltype
,
1016 LPWSTR data
, int len
, DWORD
*value
)
1018 LCID lcid
= LocaleNameToLCID(locale
, 0);
1019 FIXME("(%s, %d, %p, 0x%08x, %p, %d, %p): semi-stub\n", debugstr_w(locale
), calendar
, lpReserved
, caltype
,
1021 return GetCalendarInfoW(lcid
, calendar
, caltype
, data
, len
, value
);
1024 /*********************************************************************
1025 * SetCalendarInfoA (KERNEL32.@)
1028 int WINAPI
SetCalendarInfoA(LCID Locale
, CALID Calendar
, CALTYPE CalType
, LPCSTR lpCalData
)
1030 FIXME("(%08x,%08x,%08x,%s): stub\n",
1031 Locale
, Calendar
, CalType
, debugstr_a(lpCalData
));
1035 /*********************************************************************
1036 * SetCalendarInfoW (KERNEL32.@)
1040 int WINAPI
SetCalendarInfoW(LCID Locale
, CALID Calendar
, CALTYPE CalType
, LPCWSTR lpCalData
)
1042 FIXME("(%08x,%08x,%08x,%s): stub\n",
1043 Locale
, Calendar
, CalType
, debugstr_w(lpCalData
));
1047 /*********************************************************************
1048 * LocalFileTimeToFileTime (KERNEL32.@)
1050 BOOL WINAPI
LocalFileTimeToFileTime( const FILETIME
*localft
, LPFILETIME utcft
)
1053 LARGE_INTEGER local
, utc
;
1055 local
.u
.LowPart
= localft
->dwLowDateTime
;
1056 local
.u
.HighPart
= localft
->dwHighDateTime
;
1057 if (!(status
= RtlLocalTimeToSystemTime( &local
, &utc
)))
1059 utcft
->dwLowDateTime
= utc
.u
.LowPart
;
1060 utcft
->dwHighDateTime
= utc
.u
.HighPart
;
1062 else SetLastError( RtlNtStatusToDosError(status
) );
1067 /*********************************************************************
1068 * FileTimeToLocalFileTime (KERNEL32.@)
1070 BOOL WINAPI
FileTimeToLocalFileTime( const FILETIME
*utcft
, LPFILETIME localft
)
1073 LARGE_INTEGER local
, utc
;
1075 utc
.u
.LowPart
= utcft
->dwLowDateTime
;
1076 utc
.u
.HighPart
= utcft
->dwHighDateTime
;
1077 if (!(status
= RtlSystemTimeToLocalTime( &utc
, &local
)))
1079 localft
->dwLowDateTime
= local
.u
.LowPart
;
1080 localft
->dwHighDateTime
= local
.u
.HighPart
;
1082 else SetLastError( RtlNtStatusToDosError(status
) );
1087 /*********************************************************************
1088 * FileTimeToSystemTime (KERNEL32.@)
1090 BOOL WINAPI
FileTimeToSystemTime( const FILETIME
*ft
, LPSYSTEMTIME syst
)
1095 t
.u
.LowPart
= ft
->dwLowDateTime
;
1096 t
.u
.HighPart
= ft
->dwHighDateTime
;
1097 RtlTimeToTimeFields(&t
, &tf
);
1099 syst
->wYear
= tf
.Year
;
1100 syst
->wMonth
= tf
.Month
;
1101 syst
->wDay
= tf
.Day
;
1102 syst
->wHour
= tf
.Hour
;
1103 syst
->wMinute
= tf
.Minute
;
1104 syst
->wSecond
= tf
.Second
;
1105 syst
->wMilliseconds
= tf
.Milliseconds
;
1106 syst
->wDayOfWeek
= tf
.Weekday
;
1110 /*********************************************************************
1111 * SystemTimeToFileTime (KERNEL32.@)
1113 BOOL WINAPI
SystemTimeToFileTime( const SYSTEMTIME
*syst
, LPFILETIME ft
)
1118 tf
.Year
= syst
->wYear
;
1119 tf
.Month
= syst
->wMonth
;
1120 tf
.Day
= syst
->wDay
;
1121 tf
.Hour
= syst
->wHour
;
1122 tf
.Minute
= syst
->wMinute
;
1123 tf
.Second
= syst
->wSecond
;
1124 tf
.Milliseconds
= syst
->wMilliseconds
;
1126 if( !RtlTimeFieldsToTime(&tf
, &t
)) {
1127 SetLastError( ERROR_INVALID_PARAMETER
);
1130 ft
->dwLowDateTime
= t
.u
.LowPart
;
1131 ft
->dwHighDateTime
= t
.u
.HighPart
;
1135 /*********************************************************************
1136 * CompareFileTime (KERNEL32.@)
1138 * Compare two FILETIME's to each other.
1142 * y [I] time to compare to x
1145 * -1, 0, or 1 indicating that x is less than, equal to, or greater
1146 * than y respectively.
1148 INT WINAPI
CompareFileTime( const FILETIME
*x
, const FILETIME
*y
)
1150 if (!x
|| !y
) return -1;
1152 if (x
->dwHighDateTime
> y
->dwHighDateTime
)
1154 if (x
->dwHighDateTime
< y
->dwHighDateTime
)
1156 if (x
->dwLowDateTime
> y
->dwLowDateTime
)
1158 if (x
->dwLowDateTime
< y
->dwLowDateTime
)
1163 /*********************************************************************
1164 * GetLocalTime (KERNEL32.@)
1166 * Get the current local time.
1169 * systime [O] Destination for current time.
1174 VOID WINAPI
GetLocalTime(LPSYSTEMTIME systime
)
1177 LARGE_INTEGER ft
, ft2
;
1179 NtQuerySystemTime(&ft
);
1180 RtlSystemTimeToLocalTime(&ft
, &ft2
);
1181 lft
.dwLowDateTime
= ft2
.u
.LowPart
;
1182 lft
.dwHighDateTime
= ft2
.u
.HighPart
;
1183 FileTimeToSystemTime(&lft
, systime
);
1186 /*********************************************************************
1187 * GetSystemTime (KERNEL32.@)
1189 * Get the current system time.
1192 * systime [O] Destination for current time.
1197 VOID WINAPI
GetSystemTime(LPSYSTEMTIME systime
)
1202 NtQuerySystemTime(&t
);
1203 ft
.dwLowDateTime
= t
.u
.LowPart
;
1204 ft
.dwHighDateTime
= t
.u
.HighPart
;
1205 FileTimeToSystemTime(&ft
, systime
);
1208 /*********************************************************************
1209 * GetDaylightFlag (KERNEL32.@)
1211 * Specifies if daylight savings time is in operation.
1214 * This function is called from the Win98's control applet timedate.cpl.
1217 * TRUE if daylight savings time is in operation.
1220 BOOL WINAPI
GetDaylightFlag(void)
1222 TIME_ZONE_INFORMATION tzinfo
;
1223 return GetTimeZoneInformation( &tzinfo
) == TIME_ZONE_ID_DAYLIGHT
;
1226 /***********************************************************************
1227 * DosDateTimeToFileTime (KERNEL32.@)
1229 BOOL WINAPI
DosDateTimeToFileTime( WORD fatdate
, WORD fattime
, LPFILETIME ft
)
1234 time_t time1
, time2
;
1237 newtm
.tm_sec
= (fattime
& 0x1f) * 2;
1238 newtm
.tm_min
= (fattime
>> 5) & 0x3f;
1239 newtm
.tm_hour
= (fattime
>> 11);
1240 newtm
.tm_mday
= (fatdate
& 0x1f);
1241 newtm
.tm_mon
= ((fatdate
>> 5) & 0x0f) - 1;
1242 newtm
.tm_year
= (fatdate
>> 9) + 80;
1243 newtm
.tm_isdst
= -1;
1245 RtlSecondsSince1970ToTime( timegm(&newtm
), (LARGE_INTEGER
*)ft
);
1247 time1
= mktime(&newtm
);
1248 gtm
= gmtime(&time1
);
1249 time2
= mktime(gtm
);
1250 RtlSecondsSince1970ToTime( 2*time1
-time2
, (LARGE_INTEGER
*)ft
);
1256 /***********************************************************************
1257 * FileTimeToDosDateTime (KERNEL32.@)
1259 BOOL WINAPI
FileTimeToDosDateTime( const FILETIME
*ft
, LPWORD fatdate
,
1267 if (!fatdate
|| !fattime
)
1269 SetLastError(ERROR_INVALID_PARAMETER
);
1272 li
.u
.LowPart
= ft
->dwLowDateTime
;
1273 li
.u
.HighPart
= ft
->dwHighDateTime
;
1274 if (!RtlTimeToSecondsSince1970( &li
, &t
))
1276 SetLastError(ERROR_INVALID_PARAMETER
);
1280 tm
= gmtime( &unixtime
);
1282 *fattime
= (tm
->tm_hour
<< 11) + (tm
->tm_min
<< 5) + (tm
->tm_sec
/ 2);
1284 *fatdate
= ((tm
->tm_year
- 80) << 9) + ((tm
->tm_mon
+ 1) << 5)
1289 /*********************************************************************
1290 * GetSystemTimes (KERNEL32.@)
1292 * Retrieves system timing information
1295 * lpIdleTime [O] Destination for idle time.
1296 * lpKernelTime [O] Destination for kernel time.
1297 * lpUserTime [O] Destination for user time.
1300 * TRUE if success, FALSE otherwise.
1302 BOOL WINAPI
GetSystemTimes(LPFILETIME lpIdleTime
, LPFILETIME lpKernelTime
, LPFILETIME lpUserTime
)
1304 LARGE_INTEGER idle_time
, kernel_time
, user_time
;
1305 SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
*sppi
;
1306 SYSTEM_BASIC_INFORMATION sbi
;
1311 TRACE("(%p,%p,%p)\n", lpIdleTime
, lpKernelTime
, lpUserTime
);
1313 status
= NtQuerySystemInformation( SystemBasicInformation
, &sbi
, sizeof(sbi
), &ret_size
);
1314 if (status
!= STATUS_SUCCESS
)
1316 SetLastError( RtlNtStatusToDosError(status
) );
1320 sppi
= HeapAlloc( GetProcessHeap(), 0,
1321 sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
) * sbi
.NumberOfProcessors
);
1324 SetLastError( ERROR_OUTOFMEMORY
);
1328 status
= NtQuerySystemInformation( SystemProcessorPerformanceInformation
, sppi
, sizeof(*sppi
) * sbi
.NumberOfProcessors
,
1330 if (status
!= STATUS_SUCCESS
)
1332 HeapFree( GetProcessHeap(), 0, sppi
);
1333 SetLastError( RtlNtStatusToDosError(status
) );
1337 idle_time
.QuadPart
= 0;
1338 kernel_time
.QuadPart
= 0;
1339 user_time
.QuadPart
= 0;
1340 for (i
= 0; i
< sbi
.NumberOfProcessors
; i
++)
1342 idle_time
.QuadPart
+= sppi
[i
].IdleTime
.QuadPart
;
1343 kernel_time
.QuadPart
+= sppi
[i
].KernelTime
.QuadPart
;
1344 user_time
.QuadPart
+= sppi
[i
].UserTime
.QuadPart
;
1349 lpIdleTime
->dwLowDateTime
= idle_time
.u
.LowPart
;
1350 lpIdleTime
->dwHighDateTime
= idle_time
.u
.HighPart
;
1354 lpKernelTime
->dwLowDateTime
= kernel_time
.u
.LowPart
;
1355 lpKernelTime
->dwHighDateTime
= kernel_time
.u
.HighPart
;
1359 lpUserTime
->dwLowDateTime
= user_time
.u
.LowPart
;
1360 lpUserTime
->dwHighDateTime
= user_time
.u
.HighPart
;
1363 HeapFree( GetProcessHeap(), 0, sppi
);
1367 /***********************************************************************
1368 * GetDynamicTimeZoneInformation (KERNEL32.@)
1370 DWORD WINAPI
GetDynamicTimeZoneInformation(DYNAMIC_TIME_ZONE_INFORMATION
*tzinfo
)
1374 status
= RtlQueryDynamicTimeZoneInformation( (RTL_DYNAMIC_TIME_ZONE_INFORMATION
*)tzinfo
);
1375 if ( status
!= STATUS_SUCCESS
)
1377 SetLastError( RtlNtStatusToDosError(status
) );
1378 return TIME_ZONE_ID_INVALID
;
1380 return TIME_ZoneID( (TIME_ZONE_INFORMATION
*)tzinfo
);
1383 /***********************************************************************
1384 * QueryThreadCycleTime (KERNEL32.@)
1386 BOOL WINAPI
QueryThreadCycleTime(HANDLE thread
, PULONG64 cycle
)
1390 FIXME("(%p,%p): stub!\n", thread
, cycle
);
1391 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1395 /***********************************************************************
1396 * QueryUnbiasedInterruptTime (KERNEL32.@)
1398 BOOL WINAPI
QueryUnbiasedInterruptTime(ULONGLONG
*time
)
1400 TRACE("(%p)\n", time
);
1401 if (!time
) return FALSE
;
1402 RtlQueryUnbiasedInterruptTime(time
);