ReactOS 0.4.16-dev-319-g6cf4263
time.c File Reference
#include <k32.h>
#include <debug.h>
Include dependency graph for time.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

BOOL WINAPI IsTimeZoneRedirectionEnabled (VOID)
 
BOOL WINAPI FileTimeToDosDateTime (IN CONST FILETIME *lpFileTime, OUT LPWORD lpFatDate, OUT LPWORD lpFatTime)
 
BOOL WINAPI DosDateTimeToFileTime (IN WORD wFatDate, IN WORD wFatTime, OUT LPFILETIME lpFileTime)
 
LONG WINAPI CompareFileTime (IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
 
VOID WINAPI GetSystemTimeAsFileTime (OUT PFILETIME lpFileTime)
 
VOID WINAPI GetSystemTimePreciseAsFileTime (OUT PFILETIME lpFileTime)
 
BOOL WINAPI SystemTimeToFileTime (IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
 
BOOL WINAPI FileTimeToSystemTime (IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
 
BOOL WINAPI FileTimeToLocalFileTime (IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
 
BOOL WINAPI LocalFileTimeToFileTime (IN CONST FILETIME *lpLocalFileTime, OUT LPFILETIME lpFileTime)
 
VOID WINAPI GetLocalTime (OUT LPSYSTEMTIME lpSystemTime)
 
VOID WINAPI GetSystemTime (OUT LPSYSTEMTIME lpSystemTime)
 
BOOL WINAPI SetLocalTime (IN CONST SYSTEMTIME *lpSystemTime)
 
BOOL WINAPI SetSystemTime (IN CONST SYSTEMTIME *lpSystemTime)
 
DWORD WINAPI GetTickCount (VOID)
 
BOOL WINAPI GetSystemTimeAdjustment (OUT PDWORD lpTimeAdjustment, OUT PDWORD lpTimeIncrement, OUT PBOOL lpTimeAdjustmentDisabled)
 
BOOL WINAPI SetSystemTimeAdjustment (IN DWORD dwTimeAdjustment, IN BOOL bTimeAdjustmentDisabled)
 
BOOL WINAPI GetSystemTimes (OUT LPFILETIME lpIdleTime OPTIONAL, OUT LPFILETIME lpKernelTime OPTIONAL, OUT LPFILETIME lpUserTime OPTIONAL)
 
BOOL WINAPI SetClientTimeZoneInformation (IN CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 16 of file time.c.

Function Documentation

◆ CompareFileTime()

◆ DosDateTimeToFileTime()

BOOL WINAPI DosDateTimeToFileTime ( IN WORD  wFatDate,
IN WORD  wFatTime,
OUT LPFILETIME  lpFileTime 
)

Definition at line 75 of file time.c.

78{
80 LARGE_INTEGER SystemTime;
81
82 TimeFields.Year = (wFatDate >> 9) + 1980;
83 TimeFields.Month = (wFatDate >> 5) & 0xF;
84 TimeFields.Day = (wFatDate & 0x1F);
85 TimeFields.Hour = (wFatTime >> 11);
86 TimeFields.Minute = (wFatTime >> 5) & 0x3F;
87 TimeFields.Second = (wFatTime & 0x1F) << 1;
89
90 if (RtlTimeFieldsToTime(&TimeFields, &SystemTime))
91 {
92 lpFileTime->dwLowDateTime = SystemTime.LowPart;
93 lpFileTime->dwHighDateTime = SystemTime.HighPart;
94 return TRUE;
95 }
96
98 return FALSE;
99}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOLEAN RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields, IN PLARGE_INTEGER Time)
static PTIME_FIELDS TimeFields
Definition: time.c:104
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:167
USHORT Milliseconds
Definition: env_spec_w32.h:717
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

Referenced by _ILGetFileDateTime(), cabinet_close_file_info(), ATL::CTime::CTime(), dos_date_time_to_file_time(), DosInt21h(), ExtCabCallback(), CCabinet::ExtractFile(), CZipExtract::ExtractSingle(), fdi_notify_extract(), get_signature(), CZipFolder::GetDetailsOf(), test_conversions(), test_FileContents1(), test_FileContents2(), test_FileDescriptor(), test_FileDescriptor_Folder(), and test_invalid_arg().

◆ FileTimeToDosDateTime()

BOOL WINAPI FileTimeToDosDateTime ( IN CONST FILETIME lpFileTime,
OUT LPWORD  lpFatDate,
OUT LPWORD  lpFatTime 
)

Definition at line 37 of file time.c.

40{
41 LARGE_INTEGER FileTime;
43
44 FileTime.HighPart = lpFileTime->dwHighDateTime;
45 FileTime.LowPart = lpFileTime->dwLowDateTime;
46
47 if (FileTime.QuadPart < 0)
48 {
50 return FALSE;
51 }
52
54 if ((TimeFields.Year < 1980) || (TimeFields.Year > 2107))
55 {
57 return FALSE;
58 }
59
60 *lpFatDate = (TimeFields.Day) |
61 (TimeFields.Month << 5) |
62 ((TimeFields.Year - 1980) << 9);
63 *lpFatTime = (TimeFields.Second >> 1) |
64 (TimeFields.Minute << 5) |
65 (TimeFields.Hour << 11);
66
67 return TRUE;
68}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
BOOLEAN RtlTimeToTimeFields(IN PLARGE_INTEGER Time, IN PTIME_FIELDS TimeFields)

Referenced by _ILCreateFromFindDataW(), demFileFindFirst(), demFileFindNext(), DosInt21h(), file_time_to_dos_date_time(), get_open_info(), CCabinet::GetFileTimes(), and test_FileTimeToDosDateTime().

◆ FileTimeToLocalFileTime()

BOOL WINAPI FileTimeToLocalFileTime ( IN CONST FILETIME lpFileTime,
OUT LPFILETIME  lpLocalFileTime 
)

Definition at line 221 of file time.c.

223{
224 LARGE_INTEGER TimeZoneBias, FileTime;
225 volatile KSYSTEM_TIME *TimePtr;
226
227 TimePtr = IsTimeZoneRedirectionEnabled() ?
229 &SharedUserData->TimeZoneBias;
230 do
231 {
232 TimeZoneBias.HighPart = TimePtr->High1Time;
233 TimeZoneBias.LowPart = TimePtr->LowPart;
234 }
235 while (TimeZoneBias.HighPart != TimePtr->High2Time);
236
237 FileTime.LowPart = lpFileTime->dwLowDateTime;
238 FileTime.HighPart = lpFileTime->dwHighDateTime;
239
240 FileTime.QuadPart -= TimeZoneBias.QuadPart;
241
242 lpLocalFileTime->dwLowDateTime = FileTime.LowPart;
243 lpLocalFileTime->dwHighDateTime = FileTime.HighPart;
244
245 return TRUE;
246}
PBASE_STATIC_SERVER_DATA BaseStaticServerData
Definition: dllmain.c:19
BOOL WINAPI IsTimeZoneRedirectionEnabled(VOID)
Definition: time.c:26
#define SharedUserData
KSYSTEM_TIME ktTermsrvClientBias
Definition: base.h:139
LONG High1Time
Definition: ketypes.h:930
LONG High2Time
Definition: ketypes.h:931
ULONG LowPart
Definition: ketypes.h:929

Referenced by _ILGetFileDate(), _tmain(), DateConstr_value(), DirPrintFileDateTime(), DisplayServerStatistics(), DisplayWorkstationStatistics(), DoReadAllOfFile(), EventTimeToSystemTime(), format_date(), FormatDateTime(), get_date_from_filetime(), get_open_info(), GetEnhancedVar(), GetFileTimeString(), CFileDefExt::GetFileTimeString(), CRegistryKey::GetLastWriteTime(), PrintDateTime(), CFontInfo::ReadAttrs(), SetFileInfo(), SHFormatDateTimeW(), summaryinfo_invoke(), test_FileTimeToLocalFileTime(), test_GetTimeZoneInformation(), test_SummaryInfo(), txt_export_class_and_last_write(), ATL::CFileTime::UTCToLocal(), and WherePrintPath().

◆ FileTimeToSystemTime()

BOOL WINAPI FileTimeToSystemTime ( IN CONST FILETIME lpFileTime,
OUT LPSYSTEMTIME  lpSystemTime 
)

Definition at line 188 of file time.c.

190{
192 LARGE_INTEGER liTime;
193
194 liTime.u.LowPart = lpFileTime->dwLowDateTime;
195 liTime.u.HighPart = lpFileTime->dwHighDateTime;
196 if (liTime.QuadPart < 0)
197 {
199 return FALSE;
200 }
201
203
204 lpSystemTime->wYear = TimeFields.Year;
205 lpSystemTime->wMonth = TimeFields.Month;
206 lpSystemTime->wDay = TimeFields.Day;
207 lpSystemTime->wHour = TimeFields.Hour;
208 lpSystemTime->wMinute = TimeFields.Minute;
209 lpSystemTime->wSecond = TimeFields.Second;
210 lpSystemTime->wMilliseconds = TimeFields.Milliseconds;
211 lpSystemTime->wDayOfWeek = TimeFields.Weekday;
212
213 return TRUE;
214}
USHORT Weekday
Definition: env_spec_w32.h:718
struct _LARGE_INTEGER::@2303 u

Referenced by CZipFolder::_GetFileTimeString(), _ILGetFileDate(), _tmain(), add_cert_to_list(), add_cert_to_view(), add_date_string_to_control(), AddUserProfile(), compareTime(), CRYPT_AsnEncodeChoiceOfTime(), CRYPT_AsnEncodeGeneralizedTime(), CRYPT_AsnEncodeUtcTime(), CRYPT_MakeCertInfo(), ATL::CTime::CTime(), day_of_month(), DirPrintFileDateTime(), DisplayServerStatistics(), DisplayWorkstationStatistics(), DoReadAllOfFile(), EventTimeToSystemTime(), ExtCabCallback(), filetime_to_str(), format_date(), format_long_date(), FormatDateTime(), get_date_from_filetime(), CFontExt::GetDetailsOf(), GetDriverDateString(), GetEnhancedVar(), GetFileModifyTime(), GetFileTimeString(), CFileDefExt::GetFileTimeString(), CRegistryKey::GetLastWriteTime(), HTTPREQ_QueryOption(), CShellLink::Load(), MONTHCAL_CalculateDayOfWeek(), MONTHCAL_IsSelRangeValid(), NLS_GetDateTimeFormatW(), PrintDateTime(), printFileTime(), PrintLocalTime(), PROPVAR_ConvertFILETIME(), CInstalledApplicationInfo::RetrieveInstallDate(), RtlTimeToTimeFields(), save_prop(), SetFileInfo(), SetupDiInstallDevice(), SHFormatDateTimeW(), summaryinfo_invoke(), SystemTimeToTzSpecificLocalTime(), test4(), test_cert_struct_string(), test_FileTimeToLocalFileTime(), test_FileTimeToSystemTime(), test_GetTimeZoneInformation(), test_query_process_times(), test_SummaryInfo(), TIME_CompTimeZoneID(), txt_export_class_and_last_write(), TzSpecificLocalTimeToSystemTime(), UpdateSystemTime(), BtrfsScrub::UpdateTextBox(), WherePrintPath(), and XCOPY_ParseCommandLine().

◆ GetLocalTime()

VOID WINAPI GetLocalTime ( OUT LPSYSTEMTIME  lpSystemTime)

Definition at line 286 of file time.c.

287{
288 LARGE_INTEGER SystemTime, TimeZoneBias;
290 volatile KSYSTEM_TIME *TimePtr;
291
292 do
293 {
294 SystemTime.HighPart = SharedUserData->SystemTime.High1Time;
295 SystemTime.LowPart = SharedUserData->SystemTime.LowPart;
296 }
297 while (SystemTime.HighPart != SharedUserData->SystemTime.High2Time);
298
299 TimePtr = IsTimeZoneRedirectionEnabled() ?
301 &SharedUserData->TimeZoneBias;
302 do
303 {
304 TimeZoneBias.HighPart = TimePtr->High1Time;
305 TimeZoneBias.LowPart = TimePtr->LowPart;
306 }
307 while (TimeZoneBias.HighPart != TimePtr->High2Time);
308
309 SystemTime.QuadPart -= TimeZoneBias.QuadPart;
310 RtlTimeToTimeFields(&SystemTime, &TimeFields);
311
312 lpSystemTime->wYear = TimeFields.Year;
313 lpSystemTime->wMonth = TimeFields.Month;
314 lpSystemTime->wDay = TimeFields.Day;
315 lpSystemTime->wHour = TimeFields.Hour;
316 lpSystemTime->wMinute = TimeFields.Minute;
317 lpSystemTime->wSecond = TimeFields.Second;
318 lpSystemTime->wMilliseconds = TimeFields.Milliseconds;
319 lpSystemTime->wDayOfWeek = TimeFields.Weekday;
320}

Referenced by _getsystime(), CTrayClockWnd::CalculateDueTime(), CalculateNextStartTime(), ClockWndProc(), cmd_time(), CmosReadData(), CmosWriteData(), collect_query_data(), create_snapshot(), CreateProfile(), DATETIME_Create(), datetime_proc(), DateTimePageDlgProc(), DateTimePageProc(), DIALOG_EditTimeDate(), DoPrintDocument(), DosInt21h(), download_file(), EngQueryLocalTime(), fill_datetime_information(), FillMonthsComboBox(), FTP_ParseNextFile(), get_date_str(), get_localdatetime(), GetCurrentDayOfMonth(), GetDateString(), GetTimeAsJobTime(), GetTimeString(), Global_Date(), Global_Now(), Global_Time(), Global_Timer(), JapaneseEra_Find(), main(), MONTHCAL_Create(), MONTHCAL_Timer(), MonthCalSetLocalTime(), MonthCalSetupDayTimer(), NLS_GetDateTimeFormatW(), ClockWindow::Notify(), ParseDate(), ParseTime(), PrintSystemInfo(), pSetupDebugPrint(), publish_install_properties(), ReadPipeCompletion(), RtcTimeUpdate(), ServicesPageWndProc(), set_print_template(), TaskTriggerConstructor(), test_GetTimeZoneInformationForYear(), test_SetTrigger_GetTrigger(), test_SHFormatDateTimeA(), test_SHFormatDateTimeW(), TimerProc(), CTrayClockWnd::Update(), vsyslog(), and wWinMain().

◆ GetSystemTime()

VOID WINAPI GetSystemTime ( OUT LPSYSTEMTIME  lpSystemTime)

Definition at line 327 of file time.c.

328{
329 LARGE_INTEGER SystemTime;
331
332 do
333 {
334 SystemTime.HighPart = SharedUserData->SystemTime.High1Time;
335 SystemTime.LowPart = SharedUserData->SystemTime.LowPart;
336 }
337 while (SystemTime.HighPart != SharedUserData->SystemTime.High2Time);
338
339 RtlTimeToTimeFields(&SystemTime, &TimeFields);
340
341 lpSystemTime->wYear = TimeFields.Year;
342 lpSystemTime->wMonth = TimeFields.Month;
343 lpSystemTime->wDay = TimeFields.Day;
344 lpSystemTime->wHour = TimeFields.Hour;
345 lpSystemTime->wMinute = TimeFields.Minute;
346 lpSystemTime->wSecond = TimeFields.Second;
347 lpSystemTime->wMilliseconds = TimeFields.Milliseconds;
348 lpSystemTime->wDayOfWeek = TimeFields.Weekday;
349}

Referenced by CComCatCachedCategory::CacheDSA(), copy(), CreateJob(), RecycleBin5::DeleteFile(), ExtractAndInstallThread(), InternetTimeToSystemTimeW(), NetrRemoteTOD(), SOFTPUB_LoadCertMessage(), test_dtm_set_and_get_system_time(), test_GetDatabaseInformationEmpty(), test_GetTimeZoneInformation(), test_IWinHttpRequest(), test_monthcal(), test_not_modified(), test_RegQueryValueExPerformanceData(), test_VarDateFromStr(), test_verifyTimeValidity(), TouchFileTimes(), VARIANT_MakeDate(), WinHttpTimeToSystemTime(), and WINTRUST_CertVerifyObjTrust().

◆ GetSystemTimeAdjustment()

BOOL WINAPI GetSystemTimeAdjustment ( OUT PDWORD  lpTimeAdjustment,
OUT PDWORD  lpTimeIncrement,
OUT PBOOL  lpTimeAdjustmentDisabled 
)

Definition at line 486 of file time.c.

489{
492
494 &TimeInfo,
495 sizeof(TimeInfo),
496 NULL);
497 if (!NT_SUCCESS(Status))
498 {
500 return FALSE;
501 }
502
503 *lpTimeAdjustment = (DWORD)TimeInfo.TimeAdjustment;
504 *lpTimeIncrement = (DWORD)TimeInfo.TimeIncrement;
505 *lpTimeAdjustmentDisabled = (BOOL)TimeInfo.Enable;
506
507 return TRUE;
508}
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
unsigned long DWORD
Definition: ntddk_ex.h:95
@ SystemTimeAdjustmentInformation
Definition: ntddk_ex.h:39
Status
Definition: gdiplustypes.h:25
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)

◆ GetSystemTimeAsFileTime()

VOID WINAPI GetSystemTimeAsFileTime ( OUT PFILETIME  lpFileTime)

Definition at line 128 of file time.c.

129{
130 LARGE_INTEGER SystemTime;
131
132 do
133 {
134 SystemTime.HighPart = SharedUserData->SystemTime.High1Time;
135 SystemTime.LowPart = SharedUserData->SystemTime.LowPart;
136 }
137 while (SystemTime.HighPart != SharedUserData->SystemTime.High2Time);
138
139 lpFileTime->dwLowDateTime = SystemTime.LowPart;
140 lpFileTime->dwHighDateTime = SystemTime.HighPart;
141}

Referenced by __security_init_cookie(), _ftime_s(), _LocalGetJobLevel2(), _time(), cache_container_set_size(), CertDllVerifyRevocation(), CertTrustFinalPolicy(), CertVerifyCRLTimeValidity(), CertVerifyTimeValidity(), clock(), CoFileTimeNow(), create_cache_entry(), CRYPT_CacheURL(), CRYPT_GetObjectFromCache(), CRYPT_MakeCertInfo(), date_now(), DateConstr_value(), FileTimeNow(), FreeUrlCacheSpaceW(), get_cookie(), get_cred_mgr_encryption_key(), get_file_time(), ATL::CFileTime::GetCurrentTime(), GetCurrentTimeInSeconds(), GetJobName(), GetTimeInSeconds(), gettimeofday(), init_fs_tree(), initclock(), is_not_current(), load_persistent_cookie(), registry_write_credential(), RPC_UuidGetSystemTime(), run_child_process(), save_persistent_cookie(), SdbInstall(), SdbRegisterDatabaseEx(), set_cookie(), set_default_subvol(), SetProfileData(), START_TEST(), test_cache_read(), test_db(), test_GetSystemTimePreciseAsFileTime(), test_IsUrlCacheEntryExpiredA(), test_RegQueryValueExPerformanceData(), test_urlcacheA(), TIME_ZoneID(), urlcache_entry_commit(), urlcache_entry_create(), urlcache_entry_get_file(), urlcache_entry_is_expired(), and urlcache_hash_entry_is_locked().

◆ GetSystemTimePreciseAsFileTime()

VOID WINAPI GetSystemTimePreciseAsFileTime ( OUT PFILETIME  lpFileTime)

Definition at line 148 of file time.c.

149{
150 STUB;
151}
#define STUB
Definition: kernel32.h:27

◆ GetSystemTimes()

BOOL WINAPI GetSystemTimes ( OUT LPFILETIME lpIdleTime  OPTIONAL,
OUT LPFILETIME lpKernelTime  OPTIONAL,
OUT LPFILETIME lpUserTime  OPTIONAL 
)

Definition at line 541 of file time.c.

544{
546 LARGE_INTEGER TotalUserTime, TotalKernTime, TotalIdleTime;
548 CCHAR i;
550
551 TotalUserTime.QuadPart = TotalKernTime.QuadPart = TotalIdleTime.QuadPart = 0;
552
555
556 ProcPerfInfo = RtlAllocateHeap(RtlGetProcessHeap(), 0, BufferSize);
557 if (!ProcPerfInfo)
558 {
560 return FALSE;
561 }
562
564 ProcPerfInfo,
566 &ReturnLength);
568 {
569 if (lpIdleTime)
570 {
572 {
573 TotalIdleTime.QuadPart += ProcPerfInfo[i].IdleTime.QuadPart;
574 }
575
576 lpIdleTime->dwLowDateTime = TotalIdleTime.LowPart;
577 lpIdleTime->dwHighDateTime = TotalIdleTime.HighPart;
578 }
579
580 if (lpKernelTime)
581 {
583 {
584 TotalKernTime.QuadPart += ProcPerfInfo[i].KernelTime.QuadPart;
585 }
586
587 lpKernelTime->dwLowDateTime = TotalKernTime.LowPart;
588 lpKernelTime->dwHighDateTime = TotalKernTime.HighPart;
589 }
590
591 if (lpUserTime)
592 {
594 {
595 TotalUserTime.QuadPart += ProcPerfInfo[i].UserTime.QuadPart;
596 }
597
598 lpUserTime->dwLowDateTime = TotalUserTime.LowPart;
599 lpUserTime->dwHighDateTime = TotalUserTime.HighPart;
600 }
601 }
602 else if (NT_SUCCESS(Status))
603 {
605 }
606
607 RtlFreeHeap(RtlGetProcessHeap(), 0, ProcPerfInfo);
608 if (!NT_SUCCESS(Status))
609 {
611 return FALSE;
612 }
613
614 return TRUE;
615}
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define BufferSize
Definition: mmc.h:75
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
@ SystemProcessorPerformanceInformation
Definition: ntddk_ex.h:19
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
SYSTEM_BASIC_INFORMATION SysInfo
Definition: base.h:130
uint32_t ULONG
Definition: typedefs.h:59
char CCHAR
Definition: typedefs.h:51
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254

◆ GetTickCount()

DWORD WINAPI GetTickCount ( VOID  )

Definition at line 455 of file time.c.

456{
457 ULARGE_INTEGER TickCount;
458
459#ifdef _WIN64
460 TickCount.QuadPart = *((volatile ULONG64*)&SharedUserData->TickCount);
461#else
462 while (TRUE)
463 {
464 TickCount.HighPart = (ULONG)SharedUserData->TickCount.High1Time;
465 TickCount.LowPart = SharedUserData->TickCount.LowPart;
466
467 if (TickCount.HighPart == (ULONG)SharedUserData->TickCount.High2Time)
468 break;
469
471 }
472#endif
473
474 return (ULONG)((UInt32x32To64(TickCount.LowPart,
475 SharedUserData->TickCountMultiplier) >> 24) +
476 UInt32x32To64((TickCount.HighPart << 8) & 0xFFFFFFFF,
477 SharedUserData->TickCountMultiplier));
478
479}
#define UInt32x32To64(a, b)
Definition: intsafe.h:252
if(dx< 0)
Definition: linetemp.h:194
unsigned __int64 ULONG64
Definition: imports.h:198
#define YieldProcessor
Definition: ke.h:48
$ULONG LowPart
Definition: ntbasedef.h:577
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
$ULONG HighPart
Definition: ntbasedef.h:578

Referenced by __security_init_cookie(), _FileOpCount(), _FileOpCountManager(), _tmain(), _tWinMain(), apartment_freeunusedlibraries(), BiosMiscService(), CalibrateTest(), CardWindow::CardWindow(), check_exe(), ClockUpdate(), collect_connections(), CommandChoice(), CommandTimer(), CFileDefExt::CountFolderAndFiles(), CoWaitForMultipleHandles(), CProgressDialog::CProgressDialog(), Defragment::Defragment(), DispatchMessageA(), DispatchMessageW(), DoControlService(), DoStartService(), DoStartStartupItems(), DoStopService(), DrawGLScene(), DSOUND_callback(), DSOUND_capture_callback(), DSOUND_PrimaryGetPosition(), DSOUND_timer(), empty_message_queue(), EnableHardwareTimer(), extract_resource(), FileTypesDlg_Refresh(), flush_events(), FormatBufferFat(), GdiSAPCallback(), GenerateComputerName(), GenerateRandomPassword(), http_release_netconn(), IDirectSoundBufferImpl_GetCurrentPosition(), IDirectSoundBufferImpl_Lock(), IDirectSoundCaptureBufferImpl_Lock(), InitMatrixMessage(), InitScreenSaveClass(), InputWait(), install_cab_file(), KmtEnsureServiceState(), LBItemFromPt(), LISTVIEW_ProcessLetterKeys(), mailslot_test(), main(), make_discover(), MediaControl_GetState(), MIDI_player(), midiStreamRestart(), MMSYSTEM_MidiStream_MessageHandler(), MMSYSTEM_MidiStream_Player(), NotifyInfo::modify(), msi_create_empty_local_file(), mstsc_mousewheel(), NBNameCacheAddEntry(), NBNameCacheWalk(), NetBTAstatRemote(), NetBTNameWaitLoop(), NetBTWaitForNameResponse(), NetrRemoteTOD(), NotifyInfo::NotifyInfo(), NotifyTopLevelWindow(), AirBrushTool::OnButtonDown(), OSK_Command(), OSK_ReleaseKey(), PeekMessageWorker(), PreInit(), PrimaryBufferImpl_GetCurrentPosition(), PrimaryBufferImpl_Lock(), process_timer(), processPendingMessages(), ProcessTest(), PulseSample(), pump_msg_loop_timeout(), QUARTZ_CreateSystemClock(), QueryTime(), NotifyArea::Refresh(), TrayNotifyDlg::RefreshProperties(), remove_target_tasks(), RetrieveQuote(), RPC_GetLocalClassObject(), rpcrt4_http_timer_calc_timeout(), rpcrt4_http_timer_thread(), rpcrt4_ncacn_http_open(), rpcrt4_ncacn_http_write(), run_benchmark(), CWineTest::RunTest(), ScreenSaverProc(), ScreenSaverThreadMain(), SendGetState(), ServeSomeMessages(), ServiceStart(), set_task_timer(), SetAbortProc(), CProgressDialog::SetProgress64(), SHChangeNotify(), SHChangeNotifyReceive(), SHWaitForSendMessageThread(), SlideWindow(), SpeakerChange(), Defragment::Start(), START_TEST(), StartDocW(), StartScreenSaver(), state_reboot(), StorageImpl_LockRegionSync(), swapchain_gdi_present(), swapchain_gl_present(), SystemClockImpl_GetTime(), taskdialog_init(), taskdialog_proc(), test1(), test_AbortWaitCts(), test_api(), test_buffer(), test_buffer8(), test_dbcs_wm_char(), test_get_input_report(), test_get_state(), test_globalness(), test_ime_wnd_proc(), test_ImmGetCompositionString(), test_InputObject(), test_LoopbackRead(), test_not_modified(), test_OpenFileById(), test_QueueUserWorkItem(), test_read_device(), test_read_write(), test_ReadTimeOut(), test_runner(), test_select(), test_timers(), test_timers_no_wnd(), test_tp_timer(), test_WaitBreak(), test_WaitCommEvent(), test_WaitCts(), test_WaitDcd(), test_WaitDsr(), test_WaitRing(), test_WaitRx(), test_waittxempty(), test_WM_GETDLGCODE(), testW1(), ThemeWaitForServiceReady(), TIME_MMSysTimeCallback(), TIME_SetEventInternal(), time_stamp_callback(), TIME_TriggerCallBack(), timeGetSystemTime(), timeGetTime(), TreeListChar(), TreeListProc(), TREEVIEW_ProcessLetterKeys(), UpdateLanStatusUiDlg(), UpdateProgressBar(), verify_cert_revocation_from_dist_points_ext(), wait_for_event(), wait_move_event(), WaitService(), WDML_SyncWaitTransactionReply(), window_length_cb(), WindowProc(), wmain(), WndProc(), and NotifyArea::WndProc().

◆ IsTimeZoneRedirectionEnabled()

BOOL WINAPI IsTimeZoneRedirectionEnabled ( VOID  )

Definition at line 26 of file time.c.

27{
28 /* Return if a TS Timezone ID is active */
30}
ULONG TermsrvClientTimeZoneId
Definition: base.h:140
#define TIME_ZONE_ID_INVALID
Definition: winbase.h:312

Referenced by FileTimeToLocalFileTime(), GetLocalTime(), LocalFileTimeToFileTime(), and SetLocalTime().

◆ LocalFileTimeToFileTime()

BOOL WINAPI LocalFileTimeToFileTime ( IN CONST FILETIME lpLocalFileTime,
OUT LPFILETIME  lpFileTime 
)

Definition at line 253 of file time.c.

255{
256 LARGE_INTEGER TimeZoneBias, FileTime;
257 volatile KSYSTEM_TIME *TimePtr;
258
259 TimePtr = IsTimeZoneRedirectionEnabled() ?
261 &SharedUserData->TimeZoneBias;
262
263 do
264 {
265 TimeZoneBias.HighPart = TimePtr->High1Time;
266 TimeZoneBias.LowPart = TimePtr->LowPart;
267 }
268 while (TimeZoneBias.HighPart != TimePtr->High2Time);
269
270 FileTime.LowPart = lpLocalFileTime->dwLowDateTime;
271 FileTime.HighPart = lpLocalFileTime->dwHighDateTime;
272
273 FileTime.QuadPart += TimeZoneBias.QuadPart;
274
275 lpFileTime->dwLowDateTime = FileTime.LowPart;
276 lpFileTime->dwHighDateTime = FileTime.HighPart;
277
278 return TRUE;
279}

Referenced by cabinet_close_file_info(), CZipExtract::ExtractSingle(), fdi_notify_extract(), GetNextJobTimeout(), ATL::CFileTime::LocalToUTC(), ParseDate(), summaryinfo_invoke(), test_FileContents1(), test_FileContents2(), test_FileDescriptor(), test_FileDescriptor_Folder(), test_SHFormatDateTimeA(), and test_SHFormatDateTimeW().

◆ SetClientTimeZoneInformation()

BOOL WINAPI SetClientTimeZoneInformation ( IN CONST TIME_ZONE_INFORMATION lpTimeZoneInformation)

Definition at line 622 of file time.c.

623{
624 STUB;
625 return 0;
626}

◆ SetLocalTime()

BOOL WINAPI SetLocalTime ( IN CONST SYSTEMTIME lpSystemTime)

Definition at line 356 of file time.c.

357{
358 LARGE_INTEGER NewSystemTime, TimeZoneBias;
362 PVOID State;
363 volatile KSYSTEM_TIME *TimePtr;
364
365 TimePtr = IsTimeZoneRedirectionEnabled() ?
367 &SharedUserData->TimeZoneBias;
368 do
369 {
370 TimeZoneBias.HighPart = TimePtr->High1Time;
371 TimeZoneBias.LowPart = TimePtr->LowPart;
372 }
373 while (TimeZoneBias.HighPart != TimePtr->High2Time);
374
375 TimeFields.Year = lpSystemTime->wYear;
376 TimeFields.Month = lpSystemTime->wMonth;
377 TimeFields.Day = lpSystemTime->wDay;
378 TimeFields.Hour = lpSystemTime->wHour;
379 TimeFields.Minute = lpSystemTime->wMinute;
380 TimeFields.Second = lpSystemTime->wSecond;
381 TimeFields.Milliseconds = lpSystemTime->wMilliseconds;
382
383 if (!RtlTimeFieldsToTime(&TimeFields, &NewSystemTime))
384 {
386 return FALSE;
387 }
388
389 NewSystemTime.QuadPart += TimeZoneBias.QuadPart;
390
392 if (NT_SUCCESS(Status))
393 {
394 Status = NtSetSystemTime(&NewSystemTime, NULL);
396 }
397
398 if (!NT_SUCCESS(Status))
399 {
401 return FALSE;
402 }
403
404 return TRUE;
405}
#define SE_SYSTEMTIME_PRIVILEGE
Definition: security.c:666
NTSYSAPI NTSTATUS NTAPI RtlAcquirePrivilege(_In_ PULONG Privilege, _In_ ULONG NumPriv, _In_ ULONG Flags, _Out_ PVOID *ReturnedState)
NTSYSAPI VOID NTAPI RtlReleasePrivilege(_In_ PVOID ReturnedState)
NTSTATUS NTAPI NtSetSystemTime(IN PLARGE_INTEGER SystemTime, OUT PLARGE_INTEGER PreviousTime OPTIONAL)
Definition: time.c:458
BOOL Privilege(LPTSTR pszPrivilege, BOOL bEnable)
Definition: user_lib.cpp:531

Referenced by _setsystime(), CmosWriteData(), DosInt21h(), ParseDate(), ParseTime(), SetSystemLocalTime(), and SystemSetLocalTime().

◆ SetSystemTime()

BOOL WINAPI SetSystemTime ( IN CONST SYSTEMTIME lpSystemTime)

Definition at line 412 of file time.c.

413{
414 LARGE_INTEGER NewSystemTime;
418 PVOID State;
419
420 TimeFields.Year = lpSystemTime->wYear;
421 TimeFields.Month = lpSystemTime->wMonth;
422 TimeFields.Day = lpSystemTime->wDay;
423 TimeFields.Hour = lpSystemTime->wHour;
424 TimeFields.Minute = lpSystemTime->wMinute;
425 TimeFields.Second = lpSystemTime->wSecond;
426 TimeFields.Milliseconds = lpSystemTime->wMilliseconds;
427
428 if (!RtlTimeFieldsToTime(&TimeFields, &NewSystemTime))
429 {
431 return FALSE;
432 }
433
435 if (NT_SUCCESS(Status))
436 {
437 Status = NtSetSystemTime(&NewSystemTime, NULL);
439 }
440
441 if (!NT_SUCCESS(Status))
442 {
444 return FALSE;
445 }
446
447 return TRUE;
448}

Referenced by SystemSetTime().

◆ SetSystemTimeAdjustment()

BOOL WINAPI SetSystemTimeAdjustment ( IN DWORD  dwTimeAdjustment,
IN BOOL  bTimeAdjustmentDisabled 
)

Definition at line 515 of file time.c.

517{
520
521 TimeInfo.TimeAdjustment = (ULONG)dwTimeAdjustment;
522 TimeInfo.Enable = (BOOLEAN)bTimeAdjustmentDisabled;
523
525 &TimeInfo,
526 sizeof(TimeInfo));
527 if (!NT_SUCCESS(Status))
528 {
530 return FALSE;
531 }
532
533 return TRUE;
534}
NTSYSAPI NTSTATUS NTAPI NtSetSystemInformation(IN INT SystemInformationClass, IN PVOID SystemInformation, IN ULONG SystemInformationLength)
#define BOOLEAN
Definition: pedump.c:73

◆ SystemTimeToFileTime()

BOOL WINAPI SystemTimeToFileTime ( IN CONST SYSTEMTIME lpSystemTime,
OUT LPFILETIME  lpFileTime 
)

Definition at line 158 of file time.c.

160{
162 LARGE_INTEGER liTime;
163
164 TimeFields.Year = lpSystemTime->wYear;
165 TimeFields.Month = lpSystemTime->wMonth;
166 TimeFields.Day = lpSystemTime->wDay;
167 TimeFields.Hour = lpSystemTime->wHour;
168 TimeFields.Minute = lpSystemTime->wMinute;
169 TimeFields.Second = lpSystemTime->wSecond;
170 TimeFields.Milliseconds = lpSystemTime->wMilliseconds;
171
172 if (RtlTimeFieldsToTime(&TimeFields, &liTime))
173 {
174 lpFileTime->dwLowDateTime = liTime.u.LowPart;
175 lpFileTime->dwHighDateTime = liTime.u.HighPart;
176 return TRUE;
177 }
178
180 return FALSE;
181}

Referenced by _LocalGetJobLevel2(), _PrinterJobListCompareRoutine(), CalculateNextStartTime(), collect_query_data(), copy(), CRYPT_AsnDecodeGeneralizedTime(), CRYPT_AsnDecodeUtcTimeInternal(), CRYPT_MakeCertInfo(), day_of_month(), RecycleBin5::DeleteFile(), EventTimeToSystemTime(), FTP_ConvertFileProp(), getChain(), GetCurrentTimeInSeconds(), gettimeofday(), GetVersionInformationFromInfFile(), HTTP_ParseDateAsAsctime(), HTTP_ParseRfc1123Date(), HTTP_ParseRfc850Date(), HTTP_RetrieveEncodedObjectW(), JapaneseEra_Find(), MONTHCAL_CalculateDayOfWeek(), MONTHCAL_CompareSystemTime(), MONTHCAL_IsSelRangeValid(), MONTHCAL_SetRange(), NLS_GetDateTimeFormatW(), parse_filetime(), ParseDate(), RtlTimeFieldsToTime(), set_cookie(), SOFTPUB_LoadCertMessage(), summaryinfo_invoke(), system_time_to_minutes(), SystemTimeToTzSpecificLocalTime(), test_CERT_CHAIN_PARA_cbSize(), test_conversions(), test_decodeCTL(), test_decodeFiletime(), test_encodeCTL(), test_GetTimeZoneInformation(), test_invalid_arg(), test_SHFormatDateTimeA(), test_SHFormatDateTimeW(), test_verifyRevocation(), test_verifyTimeValidity(), testGetCertChain(), testTimeEncoding(), time_to_filetime(), TouchFileTimes(), TzSpecificLocalTimeToSystemTime(), UpdateSystemTime(), WINTRUST_CertVerifyObjTrust(), and XCOPY_ParseCommandLine().