Windows API Reference

GetSystemTime

Retrieves the current Coordinated Universal Time (UTC) or local time.

VOID GetSystemTime( _Out_ LPSYSTEMTIME lpSystemTime );

Parameters

lpSystemTime
A pointer to a SYSTEMTIME structure that receives date and time information. The structure members are set to represent the current UTC date and time.

Remarks

The GetSystemTime function retrieves the current system time as UTC. If you need the local time, use the GetLocalTime function.

The SYSTEMTIME structure provides date and time information in the following members:

  • wYear: The current year.
  • wMonth: The current month (1-12).
  • wDayOfWeek: The current day of the week (0-6; Sunday is 0).
  • wDay: The current day of the month (1-31).
  • wHour: The current hour (0-23).
  • wMinute: The current minute (0-59).
  • wSecond: The current second (0-59).
  • wMilliseconds: The current millisecond (0-999).

Requirements

Minimum supported client
Windows 2000 Professional
Minimum supported server
Windows 2000 Server
Header
winbase.h (include Windows.h)
Library
Kernel32.lib
DLL
Kernel32.dll

See Also

CreateProcess

Creates a new process and its primary thread. The new process runs in the same address space of the calling process.

BOOL CreateProcess( _In_opt_ LPCTSTR lpApplicationName, _Inout_opt_ LPTSTR lpCommandLine, _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, _In_ BOOL bInheritHandles, _In_ DWORD dwCreationFlags, _In_opt_ LPVOID lpEnvironment, _In_opt_ LPCTSTR lpCurrentDirectory, _In_ LPSTARTUPINFO lpStartupInfo, _Out_ LPPROCESS_INFORMATION lpProcessInformation );

Parameters

lpApplicationName
The name of the module to be executed. The string must be a full path or can be a relative path.
lpCommandLine
The command line string for the process to be executed.
lpProcessAttributes
A pointer to a SECURITY_ATTRIBUTES structure that specifies the security attributes of the process object.
lpThreadAttributes
A pointer to a SECURITY_ATTRIBUTES structure that specifies the security attributes of the primary thread of the new process.
bInheritHandles
If this parameter is TRUE, each handle inherited by the new process is a duplicate of the handle of the calling process. Otherwise, the handles are not inherited.
dwCreationFlags
Flags that control the priority class and behavior of the new process.
lpEnvironment
A pointer to a block of memory containing a null-terminated list of null-terminated strings, which specifies the environment for the new process.
lpCurrentDirectory
The fully qualified path of the directory for the new process to start in.
lpStartupInfo
A pointer to a STARTUPINFO structure that specifies the window station, standard handles, and appearance of the main window for the new process.
lpProcessInformation
A pointer to a PROCESS_INFORMATION structure that receives identification information, such as a handle and identifier, for the new process.

Return Value

If the function succeeds
The return value is nonzero. The function also fills the PROCESS_INFORMATION structure pointed to by lpProcessInformation.
If the function fails
The return value is zero. To get extended error information, call GetLastError.

Remarks

Use CreateProcess to create new processes. The new process is created with its own distinct address space, but by default, it inherits handles to the calling process's objects.

Requirements

Minimum supported client
Windows 2000 Professional
Minimum supported server
Windows 2000 Server
Header
processthreadsapi.h (include Windows.h)
Library
Kernel32.lib
DLL
Kernel32.dll

See Also