Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Development
System Services
Time
Time Reference
Time Functions
 GetSystemTime function
GetSystemTime function

Applies to: desktop apps | Metro style apps

Retrieves the current system date and time. The system time is expressed in Coordinated Universal Time (UTC).

To retrieve the current system date and time in local time, use the GetLocalTime function.

Syntax

void WINAPI GetSystemTime(
  __out  LPSYSTEMTIME lpSystemTime
);

Parameters

lpSystemTime [out]

A pointer to a SYSTEMTIME structure to receive the current system date and time. The lpSystemTime parameter must not be NULL. Using NULL will result in an access violation.

Return value

This function does not return a value or provide extended error information.

Remarks

To set the current system date and time, use the SetSystemTime function.

Examples

For an example, see SYSTEMTIME.

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

GetLocalTime
GetSystemTimeAdjustment
GetSystemTimeAsFileTime
SetSystemTime
System Time
SYSTEMTIME
Time Functions

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
time resolution      Lucas1024   |   Edit   |   Show History
This function seems to have a millisecond resolution, in my experience.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker