rt

解决方案 »

  1.   

    SYSTEMTIME ct;  //声明SYSTEMTIME结构的变量,声明后你可以付值
    SetLocalTime(&ct)//结构如下
    typedef struct _SYSTEMTIME {  
    WORD wYear; 
    WORD wMonth;  
    WORD wDayOfWeek;  
    WORD wDay;  
    WORD wHour;  
    WORD wMinute;  
    WORD wSecond;  
    WORD wMilliseconds;
    } SYSTEMTIME, *PSYSTEMTIME;
      

  2.   

    SetLocalTimeThe SetLocalTime function sets the current local time and date.
    BOOL SetLocalTime(
      const SYSTEMTIME* lpSystemTime
    );Parameters
    lpSystemTime 
    [in] Pointer to a SYSTEMTIME structure that contains the current local date and time. 
    The wDayOfWeek member of the SYSTEMTIME structure is ignored.Return Values
    If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, call GetLastError.Res
    The SetLocalTime function enables the SE_SYSTEMTIME_NAME privilege before changing the local time. This privilege is disabled by default. For more information, see Running with Special Privileges.
    Windows Server 2003, Windows XP/2000/NT:  The system uses UTC internally. Therefore, when you call SetLocalTime, the system uses the current time zone information to perform the conversion, including the daylight saving time setting. Note that the system uses the daylight saving time setting of the current time, not the new time you are setting. Therefore, to ensure the correct result, call SetLocalTime a second time, now that the first call has updated the daylight saving time setting.
    Requirements
    Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, and Windows 95.
    Server: Included in Windows Server 2003, Windows 2000 Server, and Windows NT Server.
    Header: Declared in Winbase.h; include Windows.h.
    Library: Use Kernel32.lib.