Setting the System Time

This is a discussion on Setting the System Time within the C Programming forums, part of the General Programming Boards category; I am trying to write a piece of code that will set the system time (ie change the time on ...

  1. #1
    Unregistered
    Guest

    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
    Posts
    2,267
    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.
    } SYSTEMTIME;

    Members
    wYear
    Specifies the current year.
    wMonth
    Specifies the current month; January = 1, February = 2, and so on.
    wDayOfWeek
    Specifies the current day of the week; Sunday = 0, Monday = 1, and so on.
    wDay
    Specifies the current day of the month.
    wHour
    Specifies the current hour.
    wMinute
    Specifies the current minute.
    wSecond
    Specifies the current second.
    wMilliseconds
    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, 10:25 AM
  2. Need help with time
    By Gong in forum C++ Programming
    Replies: 7
    Last Post: 01-11-2007, 02:43 PM
  3. Read and set\change system time
    By Hexxx in forum C++ Programming
    Replies: 9
    Last Post: 01-02-2006, 07:11 AM
  4. Replies: 4
    Last Post: 06-13-2005, 10:03 AM
  5. Passing system time to a function
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 02-14-2002, 01:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21