Thread: Setting the System Time

  1. #1

    Question Setting the System Time

    I am trying to write a piece of code that will set the system time (ie change the time on the PC clock). I need to know how to set it on both machines running Windows NT and on the Solaris platform. When I say time I mean change the full time and date. Can anyone help?

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    i cant help with solaris but on WinNT,
    from the MSDN,

    BOOL SetSystemTime(
    CONST SYSTEMTIME *lpSystemTime // address of system time to set

    typedef struct _SYSTEMTIME { // st
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds; // Specifies the current millisecond.

    Specifies the current year.
    Specifies the current month; January = 1, February = 2, and so on.
    Specifies the current day of the week; Sunday = 0, Monday = 1, and so on.
    Specifies the current day of the month.
    Specifies the current hour.
    Specifies the current minute.
    Specifies the current second.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 09:25 AM
  2. Need help with time
    By Gong in forum C++ Programming
    Replies: 7
    Last Post: 01-11-2007, 01:43 PM
  3. Read and set\change system time
    By Hexxx in forum C++ Programming
    Replies: 9
    Last Post: 01-02-2006, 06:11 AM
  4. Replies: 4
    Last Post: 06-13-2005, 09:03 AM
  5. Passing system time to a function
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 02-14-2002, 12:56 PM
Website Security Test